\input{preamble}

% OK, start here.
%
\begin{document}

\title{Cohomology on Sites}


\maketitle

\phantomsection
\label{section-phantom}

\tableofcontents

\section{Introduction}
\label{section-introduction}

\noindent
In this document we work out some topics on cohomology of sheaves.
We work out what happens for sheaves on sites,
although often we will simply duplicate the discussion,
the constructions, and the proofs from the topological
case in the case.
Basic references are \cite{SGA4}, \cite{Godement} and \cite{Iversen}.




\section{Cohomology of sheaves}
\label{section-cohomology-sheaves}

\noindent
Let $\mathcal{C}$ be a site, see
Sites, Definition \ref{sites-definition-site}.
Let $\mathcal{F}$ be an abelian sheaf on $\mathcal{C}$.
We know that the category of abelian sheaves on $\mathcal{C}$
has enough injectives, see
Injectives, Theorem \ref{injectives-theorem-sheaves-injectives}.
Hence we can choose an injective resolution
$\mathcal{F}[0] \to \mathcal{I}^\bullet$.
For any object $U$ of the site $\mathcal{C}$ we define
\begin{equation}
\label{equation-cohomology-object-site}
H^i(U, \mathcal{F}) = H^i(\Gamma(U, \mathcal{I}^\bullet))
\end{equation}
to be the {\it $i$th cohomology group of the abelian sheaf
$\mathcal{F}$ over the object $U$}. In other words, these are the
right derived functors of the functor $\mathcal{F} \mapsto \mathcal{F}(U)$.
The family of functors $H^i(U, -)$ forms a universal $\delta$-functor
$\textit{Ab}(\mathcal{C}) \to \textit{Ab}$.

\medskip\noindent
It sometimes happens that
the site $\mathcal{C}$ does not have a final object. In this
case we define the {\it global sections} of a presheaf
of sets $\mathcal{F}$ over $\mathcal{C}$ to be the set
\begin{equation}
\label{equation-global-sections}
\Gamma(\mathcal{C}, \mathcal{F}) =
\Mor_{\textit{PSh}(\mathcal{C})}(e, \mathcal{F})
\end{equation}
where $e$ is a final object in the category of presheaves on $\mathcal{C}$.
In this case, given an abelian sheaf $\mathcal{F}$ on $\mathcal{C}$,
we define the {\it $i$th cohomology group of $\mathcal{F}$ on $\mathcal{C}$}
as follows
\begin{equation}
\label{equation-cohomology}
H^i(\mathcal{C}, \mathcal{F}) = H^i(\Gamma(\mathcal{C}, \mathcal{I}^\bullet))
\end{equation}
in other words, it is the $i$th right derived functor of the
global sections functor.
The family of functors $H^i(\mathcal{C}, -)$ forms a universal $\delta$-functor
$\textit{Ab}(\mathcal{C}) \to \textit{Ab}$.

\medskip\noindent
Let $f : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$ be a morphism of topoi, see
Sites, Definition \ref{sites-definition-topos}.
With $\mathcal{F}[0] \to \mathcal{I}^\bullet$ as above
we define
\begin{equation}
\label{equation-higher-direct-image}
R^if_*\mathcal{F} = H^i(f_*\mathcal{I}^\bullet)
\end{equation}
to be the {\it $i$th higher direct image of $\mathcal{F}$}.
These are the right derived functors of $f_*$.
The family of functors $R^if_*$ forms a universal $\delta$-functor
from $\textit{Ab}(\mathcal{C}) \to \textit{Ab}(\mathcal{D})$.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site, see
Modules on Sites, Definition \ref{sites-modules-definition-ringed-site}.
Let $\mathcal{F}$ be an $\mathcal{O}$-module.
We know that the category of $\mathcal{O}$-modules
has enough injectives, see
Injectives, Theorem \ref{injectives-theorem-sheaves-modules-injectives}.
Hence we can choose an injective resolution
$\mathcal{F}[0] \to \mathcal{I}^\bullet$.
For any object $U$ of the site $\mathcal{C}$ we define
\begin{equation}
\label{equation-cohomology-object-site-modules}
H^i(U, \mathcal{F}) = H^i(\Gamma(U, \mathcal{I}^\bullet))
\end{equation}
to be the {\it the $i$th cohomology group of $\mathcal{F}$ over $U$}.
The family of functors $H^i(U, -)$ forms a universal $\delta$-functor
$\textit{Mod}(\mathcal{O}) \to \text{Mod}_{\mathcal{O}(U)}$. Similarly
\begin{equation}
\label{equation-cohomology-modules}
H^i(\mathcal{C}, \mathcal{F}) = H^i(\Gamma(\mathcal{C}, \mathcal{I}^\bullet))
\end{equation}
it the {\it $i$th cohomology group of $\mathcal{F}$ on $\mathcal{C}$}.
The family of functors $H^i(\mathcal{C}, -)$ forms a universal
$\delta$-functor
$\textit{Mod}(\mathcal{C}) \to \text{Mod}_{\Gamma(\mathcal{C}, \mathcal{O})}$.

\medskip\noindent
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{D}), \mathcal{O}')$
be a morphism of ringed topoi, see
Modules on Sites, Definition \ref{sites-modules-definition-ringed-topos}.
With $\mathcal{F}[0] \to \mathcal{I}^\bullet$ as above
we define
\begin{equation}
\label{equation-higher-direct-image-modules}
R^if_*\mathcal{F} = H^i(f_*\mathcal{I}^\bullet)
\end{equation}
to be the {\it $i$th higher direct image of $\mathcal{F}$}.
These are the right derived functors of $f_*$.
The family of functors $R^if_*$ forms a universal $\delta$-functor
from $\textit{Mod}(\mathcal{O}) \to \textit{Mod}(\mathcal{O}')$.








\section{Derived functors}
\label{section-derived-functors}

\noindent
We briefly explain an approach to right derived functors using resolution
functors. Namely, suppose that $(\mathcal{C}, \mathcal{O})$ is a ringed site.
In this chapter we will write
$$
K(\mathcal{O}) = K(\textit{Mod}(\mathcal{O}))
\quad
\text{and}
\quad
D(\mathcal{O}) = D(\textit{Mod}(\mathcal{O}))
$$
and similarly for the bounded versions for the triangulated categories
introduced in
Derived Categories, Definition \ref{derived-definition-complexes-notation} and
Definition \ref{derived-definition-unbounded-derived-category}.
By
Derived Categories, Remark \ref{derived-remark-big-abelian-category}
there exists a resolution functor
$$
j = j_{(\mathcal{C}, \mathcal{O})} :
K^{+}(\textit{Mod}(\mathcal{O}))
\longrightarrow
K^{+}(\mathcal{I})
$$
where $\mathcal{I}$ is the strictly full additive subcategory of
$\textit{Mod}(\mathcal{O})$ which consists of injective $\mathcal{O}$-modules.
For any left exact functor $F : \textit{Mod}(\mathcal{O}) \to \mathcal{B}$
into any abelian category $\mathcal{B}$ we will denote $RF$ the
right derived functor of
Derived Categories, Section \ref{derived-section-right-derived-functor}
constructed using the resolution functor $j$ just described:
\begin{equation}
\label{equation-RF}
RF = F \circ j' : D^{+}(\mathcal{O}) \longrightarrow D^{+}(\mathcal{B})
\end{equation}
see
Derived Categories, Lemma \ref{derived-lemma-right-derived-functor}
for notation. Note that we may think of $RF$ as defined on
$\textit{Mod}(\mathcal{O})$, $\text{Comp}^{+}(\textit{Mod}(\mathcal{O}))$, or
$K^{+}(\mathcal{O})$ depending on the situation. According to
Derived Categories, Definition \ref{derived-definition-higher-derived-functors}
we obtain the $i$the right derived functor
\begin{equation}
\label{equation-RFi}
R^iF = H^i \circ RF : \textit{Mod}(\mathcal{O}) \longrightarrow \mathcal{B}
\end{equation}
so that $R^0F = F$ and $\{R^iF, \delta\}_{i \geq 0}$ is universal
$\delta$-functor, see
Derived Categories, Lemma \ref{derived-lemma-higher-derived-functors}.

\medskip\noindent
Here are two special cases of this construction. Given a ring $R$ we write
$K(R) = K(\text{Mod}_R)$ and $D(R) = D(\text{Mod}_R)$ and similarly for the
bounded versions. For any object $U$ of $\mathcal{C}$ have a left exact functor
$
\Gamma(U, -) :
\textit{Mod}(\mathcal{O})
\longrightarrow
\text{Mod}_{\mathcal{O}(U)}
$
which gives rise to
$$
R\Gamma(U, -) :
D^{+}(\mathcal{O})
\longrightarrow
D^{+}(\mathcal{O}(U))
$$
by the discussion above. Note that $H^i(U, -) = R^i\Gamma(U, -)$
is compatible with (\ref{equation-cohomology-object-site-modules}) above.
We similarly have
$$
R\Gamma(\mathcal{C}, -) :
D^{+}(\mathcal{O})
\longrightarrow
D^{+}(\Gamma(\mathcal{C}, \mathcal{O}))
$$
compatible with (\ref{equation-cohomology-modules}). If
$f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{D}), \mathcal{O}')$
is a morphism of ringed topoi then we get a left exact functor
$f_* : \textit{Mod}(\mathcal{O}) \to \textit{Mod}(\mathcal{O}')$
which gives rise to {\it derived pushforward}
$$
Rf_* : D^{+}(\mathcal{O}) \to D^+(\mathcal{O}')
$$
The $i$th cohomology sheaf of $Rf_*\mathcal{F}^\bullet$ is denoted
$R^if_*\mathcal{F}^\bullet$ and called the $i$th {\it higher direct image}
in accordance with (\ref{equation-higher-direct-image-modules}).
The displayed functors above are exact functor
of derived categories.







\section{First cohomology and torsors}
\label{section-h1-torsors}

\begin{definition}
\label{definition-torsor}
Let $\mathcal{C}$ be a site.
Let $\mathcal{G}$ be a sheaf of (possibly non-commutative)
groups on $\mathcal{C}$.
A {\it pseudo torsor}, or more precisely a
{\it pseudo $\mathcal{G}$-torsor}, is a sheaf
of sets $\mathcal{F}$ on $\mathcal{C}$ endowed with an action
$\mathcal{G} \times \mathcal{F} \to \mathcal{F}$ such that
\begin{enumerate}
\item whenever $\mathcal{F}(U)$ is nonempty the action
$\mathcal{G}(U) \times \mathcal{F}(U) \to \mathcal{F}(U)$
is simply transitive.
\end{enumerate}
A {\it morphism of pseudo $\mathcal{G}$-torsors}
$\mathcal{F} \to \mathcal{F}'$
is simply a morphism of sheaves of sets compatible with the
$\mathcal{G}$-actions.
A {\it torsor}, or more precisely a
{\it $\mathcal{G}$-torsor}, is a pseudo $\mathcal{G}$-torsor such that
in addition
\begin{enumerate}
\item[(2)] for every $U \in \Ob(\mathcal{C})$
there exists a covering $\{U_i \to U\}_{i \in I}$ of $U$
such that $\mathcal{F}(U_i)$ is nonempty for all $i \in I$.
\end{enumerate}
A {\it morphism of $\mathcal{G}$-torsors} is simply a morphism of
pseudo $\mathcal{G}$-torsors.
The {\it trivial $\mathcal{G}$-torsor}
is the sheaf $\mathcal{G}$ endowed with the obvious left
$\mathcal{G}$-action.
\end{definition}

\noindent
It is clear that a morphism of torsors is automatically an isomorphism.

\begin{lemma}
\label{lemma-trivial-torsor}
Let $\mathcal{C}$ be a site.
Let $\mathcal{G}$ be a sheaf of (possibly non-commutative)
groups on $\mathcal{C}$.
A $\mathcal{G}$-torsor $\mathcal{F}$ is trivial if and only if
$\Gamma(\mathcal{C}, \mathcal{F}) \not = \emptyset$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-torsors-h1}
Let $\mathcal{C}$ be a site.
Let $\mathcal{H}$ be an abelian sheaf on $\mathcal{C}$.
There is a canonical bijection between the set of isomorphism
classes of $\mathcal{H}$-torsors and $H^1(\mathcal{C}, \mathcal{H})$.
\end{lemma}

\begin{proof}
Let $\mathcal{F}$ be a $\mathcal{H}$-torsor.
Consider the free abelian sheaf $\mathbf{Z}[\mathcal{F}]$
on $\mathcal{F}$. It is the sheafification of the rule
which associates to $U \in \Ob(\mathcal{C})$ the collection of finite
formal sums $\sum n_i[s_i]$ with $n_i \in \mathbf{Z}$
and $s_i \in \mathcal{F}(U)$. There is a natural map
$$
\sigma : \mathbf{Z}[\mathcal{F}] \longrightarrow \underline{\mathbf{Z}}
$$
which to a local section $\sum n_i[s_i]$ associates $\sum n_i$.
The kernel of $\sigma$ is generated by sections of the form
$[s] - [s']$. There is a canonical map
$a : \Ker(\sigma) \to \mathcal{H}$
which maps $[s] - [s'] \mapsto h$ where $h$ is the local section of
$\mathcal{H}$ such that $h \cdot s = s'$. Consider the pushout diagram
$$
\xymatrix{
0 \ar[r] &
\Ker(\sigma) \ar[r] \ar[d]^a &
\mathbf{Z}[\mathcal{F}] \ar[r] \ar[d] &
\underline{\mathbf{Z}} \ar[r] \ar[d] &
0 \\
0 \ar[r] &
\mathcal{H} \ar[r] &
\mathcal{E} \ar[r] &
\underline{\mathbf{Z}} \ar[r] &
0
}
$$
Here $\mathcal{E}$ is the extension obtained by pushout.
From the long exact cohomology sequence associated to the lower
short exact sequence we obtain an element
$\xi = \xi_\mathcal{F} \in H^1(\mathcal{C}, \mathcal{H})$
by applying the boundary operator to
$1 \in H^0(\mathcal{C}, \underline{\mathbf{Z}})$.

\medskip\noindent
Conversely, given $\xi \in H^1(\mathcal{C}, \mathcal{H})$ we can associate to
$\xi$ a torsor as follows. Choose an embedding $\mathcal{H} \to \mathcal{I}$
of $\mathcal{H}$ into an injective abelian sheaf $\mathcal{I}$. We set
$\mathcal{Q} = \mathcal{I}/\mathcal{H}$ so that we have a short exact
sequence
$$
\xymatrix{
0 \ar[r] &
\mathcal{H} \ar[r] &
\mathcal{I} \ar[r] &
\mathcal{Q} \ar[r] &
0
}
$$
The element $\xi$ is the image of a global section
$q \in H^0(\mathcal{C}, \mathcal{Q})$
because $H^1(\mathcal{C}, \mathcal{I}) = 0$ (see
Derived Categories, Lemma \ref{derived-lemma-higher-derived-functors}).
Let $\mathcal{F} \subset \mathcal{I}$ be the subsheaf (of sets) of sections
that map to $q$ in the sheaf $\mathcal{Q}$. It is easy to verify that
$\mathcal{F}$ is a $\mathcal{H}$-torsor.

\medskip\noindent
We omit the verification that the two constructions given
above are mutually inverse.
\end{proof}






\section{First cohomology and extensions}
\label{section-h1-extensions}

\begin{lemma}
\label{lemma-h1-extensions}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}$ be a sheaf of $\mathcal{O}$-modules on $\mathcal{C}$.
There is a canonical bijection
$$
\Ext^1_{\textit{Mod}(\mathcal{O})}(\mathcal{O}, \mathcal{F})
\longrightarrow
H^1(\mathcal{C}, \mathcal{F})
$$
which associates to the extension
$$
0 \to \mathcal{F} \to \mathcal{E} \to \mathcal{O} \to 0
$$
the image of $1 \in \Gamma(\mathcal{C}, \mathcal{O})$ in
$H^1(\mathcal{C}, \mathcal{F})$.
\end{lemma}

\begin{proof}
Let us construct the inverse of the map given in the lemma.
Let $\xi \in H^1(\mathcal{C}, \mathcal{F})$.
Choose an injection $\mathcal{F} \subset \mathcal{I}$ with
$\mathcal{I}$ injective in $\textit{Mod}(\mathcal{O})$.
Set $\mathcal{Q} = \mathcal{I}/\mathcal{F}$.
By the long exact sequence of cohomology, we see that
$\xi$ is the image of a section
$\tilde \xi \in \Gamma(\mathcal{C}, \mathcal{Q}) =
\Hom_\mathcal{O}(\mathcal{O}, \mathcal{Q})$.
Now, we just form the pullback
$$
\xymatrix{
0 \ar[r] &
\mathcal{F} \ar[r] \ar@{=}[d] &
\mathcal{E} \ar[r] \ar[d] &
\mathcal{O} \ar[r] \ar[d]^{\tilde \xi} &
0 \\
0 \ar[r] &
\mathcal{F} \ar[r] &
\mathcal{I} \ar[r] &
\mathcal{Q} \ar[r] &
0
}
$$
see Homology, Section \ref{homology-section-extensions}.
\end{proof}

\noindent
The following lemma will be superseded by the more general
Lemma \ref{lemma-cohomology-modules-abelian-agree}.

\begin{lemma}
\label{lemma-h1-mod-ab-agree}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}$ be a sheaf of $\mathcal{O}$-modules on $\mathcal{C}$.
Let $\mathcal{F}_{ab}$ denote the underlying sheaf of abelian
groups. Then there is a functorial isomorphism
$$
H^1(\mathcal{C}, \mathcal{F}_{ab})
=
H^1(\mathcal{C}, \mathcal{F})
$$
where the left hand side is cohomology computed in
$\textit{Ab}(\mathcal{C})$ and the right hand side
is cohomology computed in $\textit{Mod}(\mathcal{O})$.
\end{lemma}

\begin{proof}
Let $\underline{\mathbf{Z}}$ denote the constant sheaf
$\mathbf{Z}$. As
$\textit{Ab}(\mathcal{C}) = \textit{Mod}(\underline{\mathbf{Z}})$
we may apply
Lemma \ref{lemma-h1-extensions}
twice, and it follows that we have to show
$$
\Ext^1_{\textit{Mod}(\mathcal{O})}(\mathcal{O}, \mathcal{F})
=
\Ext^1_{\textit{Mod}(\underline{\mathbf{Z}})}(
\underline{\mathbf{Z}}, \mathcal{F}_{ab}).
$$
Suppose that $0 \to \mathcal{F} \to \mathcal{E} \to \mathcal{O} \to 0$
is an extension in $\textit{Mod}(\mathcal{O})$. Then we can use
the obvious map of abelian sheaves
$1 : \underline{\mathbf{Z}} \to \mathcal{O}$
and pullback to obtain an extension $\mathcal{E}_{ab}$, like so:
$$
\xymatrix{
0 \ar[r] &
\mathcal{F}_{ab} \ar[r] \ar@{=}[d] &
\mathcal{E}_{ab} \ar[r] \ar[d] &
\underline{\mathbf{Z}} \ar[r] \ar[d]^{1} &
0 \\
0 \ar[r] &
\mathcal{F} \ar[r] &
\mathcal{E} \ar[r] &
\mathcal{O} \ar[r] &
0
}
$$
The converse is a little more fun. Suppose that
$0 \to \mathcal{F}_{ab} \to \mathcal{E}_{ab} \to \underline{\mathbf{Z}} \to 0$
is an extension in $\textit{Mod}(\underline{\mathbf{Z}})$.
Since $\underline{\mathbf{Z}}$ is a flat $\underline{\mathbf{Z}}$-module
we see that the sequence
$$
0 \to \mathcal{F}_{ab} \otimes_{\underline{\mathbf{Z}}} \mathcal{O}
\to \mathcal{E}_{ab} \otimes_{\underline{\mathbf{Z}}} \mathcal{O}
\to \underline{\mathbf{Z}} \otimes_{\underline{\mathbf{Z}}} \mathcal{O}
\to 0
$$
is exact, see
Modules on Sites, Lemma \ref{sites-modules-lemma-flat-tor-zero}.
Of course
$\underline{\mathbf{Z}} \otimes_{\underline{\mathbf{Z}}} \mathcal{O}
= \mathcal{O}$.
Hence we can form the pushout via the ($\mathcal{O}$-linear) multiplication map
$\mu : \mathcal{F} \otimes_{\underline{\mathbf{Z}}} \mathcal{O}
\to \mathcal{F}$ to get an extension of $\mathcal{O}$ by
$\mathcal{F}$, like this
$$
\xymatrix{
0 \ar[r] &
\mathcal{F}_{ab} \otimes_{\underline{\mathbf{Z}}} \mathcal{O}
\ar[r] \ar[d]^\mu &
\mathcal{E}_{ab} \otimes_{\underline{\mathbf{Z}}} \mathcal{O}
\ar[r] \ar[d] &
\mathcal{O} \ar[r] \ar@{=}[d] &
0 \\
0 \ar[r] &
\mathcal{F} \ar[r] &
\mathcal{E} \ar[r] &
\mathcal{O} \ar[r] &
0
}
$$
which is the desired extension. We omit the verification that these
constructions are mutually inverse.
\end{proof}





\section{First cohomology and invertible sheaves}
\label{section-invertible-sheaves}

\noindent
The Picard group of a ringed site is defined in
Modules on Sites, Section \ref{sites-modules-section-invertible}.

\begin{lemma}
\label{lemma-h1-invertible}
Let $(\mathcal{C}, \mathcal{O})$ be a locally ringed site.
There is a canonical isomorphism
$$
H^1(\mathcal{C}, \mathcal{O}^*) = \Pic(\mathcal{O}).
$$
of abelian groups.
\end{lemma}

\begin{proof}
Let $\mathcal{L}$ be an invertible $\mathcal{O}$-module.
Consider the presheaf $\mathcal{L}^*$ defined by the rule
$$
U \longmapsto \{s \in \mathcal{L}(U)
\text{ such that } \mathcal{O}_U \xrightarrow{s \cdot -} \mathcal{L}_U
\text{ is an isomorphism}\}
$$
This presheaf satisfies the sheaf condition. Moreover, if
$f \in \mathcal{O}^*(U)$ and $s \in \mathcal{L}^*(U)$, then clearly
$fs \in \mathcal{L}^*(U)$. By the same token, if $s, s' \in \mathcal{L}^*(U)$
then there exists a unique $f \in \mathcal{O}^*(U)$ such that
$fs = s'$. Moreover, the sheaf $\mathcal{L}^*$ has sections locally
by Modules on Sites, Lemma
\ref{sites-modules-lemma-invertible-is-locally-free-rank-1}.
In other words we
see that $\mathcal{L}^*$ is a $\mathcal{O}^*$-torsor. Thus we get
a map
$$
\begin{matrix}
\text{set of invertible sheaves on }(\mathcal{C}, \mathcal{O}) \\
\text{ up to isomorphism}
\end{matrix}
\longrightarrow
\begin{matrix}
\text{set of }\mathcal{O}^*\text{-torsors} \\
\text{ up to isomorphism}
\end{matrix}
$$
We omit the verification that this is a homomorphism of abelian groups.
By
Lemma \ref{lemma-torsors-h1}
the right hand side is canonically
bijective to $H^1(\mathcal{C}, \mathcal{O}^*)$.
Thus we have to show this map is injective and surjective.

\medskip\noindent
Injective. If the torsor $\mathcal{L}^*$ is trivial, this means by
Lemma \ref{lemma-trivial-torsor}
that $\mathcal{L}^*$ has a global section.
Hence this means exactly that $\mathcal{L} \cong \mathcal{O}$ is
the neutral element in $\Pic(\mathcal{O})$.

\medskip\noindent
Surjective. Let $\mathcal{F}$ be an $\mathcal{O}^*$-torsor.
Consider the presheaf of sets
$$
\mathcal{L}_1 : U \longmapsto
(\mathcal{F}(U) \times \mathcal{O}(U))/\mathcal{O}^*(U)
$$
where the action of $f \in \mathcal{O}^*(U)$ on
$(s, g)$ is $(fs, f^{-1}g)$. Then $\mathcal{L}_1$ is a presheaf
of $\mathcal{O}$-modules by setting
$(s, g) + (s', g') = (s, g + (s'/s)g')$ where $s'/s$ is the local
section $f$ of $\mathcal{O}^*$ such that $fs = s'$, and
$h(s, g) = (s, hg)$ for $h$ a local section of $\mathcal{O}$.
We omit the verification that the sheafification
$\mathcal{L} = \mathcal{L}_1^\#$ is an invertible $\mathcal{O}$-module
whose associated $\mathcal{O}^*$-torsor $\mathcal{L}^*$ is isomorphic
to $\mathcal{F}$.
\end{proof}









\section{Locality of cohomology}
\label{section-locality}

\noindent
The following lemma says there is no ambiguity in defining the cohomology
of a sheaf $\mathcal{F}$ over an object of the site.

\begin{lemma}
\label{lemma-cohomology-of-open}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $U$ be an object of $\mathcal{C}$.
\begin{enumerate}
\item If $\mathcal{I}$ is an injective $\mathcal{O}$-module
then $\mathcal{I}|_U$ is an injective $\mathcal{O}_U$-module.
\item For any sheaf of $\mathcal{O}$-modules $\mathcal{F}$ we have
$H^p(U, \mathcal{F}) = H^p(\mathcal{C}/U, \mathcal{F}|_U)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Recall that the functor $j_U^{-1}$ of restriction to $U$ is a right adjoint
to the functor $j_{U!}$ of extension by $0$, see
Modules on Sites, Section
\ref{sites-modules-section-localize}.
Moreover, $j_{U!}$ is exact. Hence (1) follows from
Homology, Lemma \ref{homology-lemma-adjoint-preserve-injectives}.

\medskip\noindent
By definition $H^p(U, \mathcal{F}) = H^p(\mathcal{I}^\bullet(U))$
where $\mathcal{F} \to \mathcal{I}^\bullet$ is an injective resolution
in $\textit{Mod}(\mathcal{O})$.
By the above we see that $\mathcal{F}|_U \to \mathcal{I}^\bullet|_U$
is an injective resolution in $\textit{Mod}(\mathcal{O}_U)$.
Hence $H^p(U, \mathcal{F}|_U)$ is equal to
$H^p(\mathcal{I}^\bullet|_U(U))$.
Of course $\mathcal{F}(U) = \mathcal{F}|_U(U)$ for
any sheaf $\mathcal{F}$ on $\mathcal{C}$.
Hence the equality in (2).
\end{proof}

\noindent
The following lemma will be use to see what happens if we change a
partial universe, or to compare cohomology of the small and big \'etale
sites.

\begin{lemma}
\label{lemma-cohomology-bigger-site}
Let $\mathcal{C}$ and $\mathcal{D}$ be sites.
Let $u : \mathcal{C} \to \mathcal{D}$ be a functor.
Assume $u$ satisfies the hypotheses of
Sites, Lemma \ref{sites-lemma-bigger-site}.
Let $g : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$
be the associated morphism of topoi.
For any abelian sheaf $\mathcal{F}$ on $\mathcal{D}$ we have
isomorphisms
$$
R\Gamma(\mathcal{C}, g^{-1}\mathcal{F}) = R\Gamma(\mathcal{D}, \mathcal{F}),
$$
in particular
$H^p(\mathcal{C}, g^{-1}\mathcal{F}) = H^p(\mathcal{D}, \mathcal{F})$
and for any $U \in \Ob(\mathcal{C})$ we have isomorphisms
$$
R\Gamma(U, g^{-1}\mathcal{F}) = R\Gamma(u(U), \mathcal{F}),
$$
in particular
$H^p(U, g^{-1}\mathcal{F}) = H^p(u(U), \mathcal{F})$. All of these
isomorphisms are functorial in $\mathcal{F}$.
\end{lemma}

\begin{proof}
Since it is clear that
$\Gamma(\mathcal{C}, g^{-1}\mathcal{F}) = \Gamma(\mathcal{D}, \mathcal{F})$
by hypothesis (e), it suffices to show that $g^{-1}$ transforms injective
abelian sheaves into injective abelian sheaves. As usual we use
Homology, Lemma \ref{homology-lemma-adjoint-preserve-injectives}
to see this. The left adjoint to $g^{-1}$ is $g_! = f^{-1}$ with the
notation of
Sites, Lemma \ref{sites-lemma-bigger-site}
which is an exact functor. Hence the lemma does indeed apply.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}$ be a sheaf of $\mathcal{O}$-modules.
Let $\varphi : U \to V$ be a morphism of $\mathcal{O}$.
Then there is a canonical {\it restriction mapping}
\begin{equation}
\label{equation-restriction-mapping}
H^n(V, \mathcal{F})
\longrightarrow
H^n(U, \mathcal{F}), \quad
\xi \longmapsto \xi|_U
\end{equation}
functorial in $\mathcal{F}$. Namely, choose any injective
resolution $\mathcal{F} \to \mathcal{I}^\bullet$. The restriction
mappings of the sheaves $\mathcal{I}^p$ give a morphism of complexes
$$
\Gamma(V, \mathcal{I}^\bullet)
\longrightarrow
\Gamma(U, \mathcal{I}^\bullet)
$$
The LHS is a complex representing $R\Gamma(V, \mathcal{F})$
and the RHS is a complex representing $R\Gamma(U, \mathcal{F})$.
We get the map on cohomology groups by applying the functor $H^n$.
As indicated we will use the notation $\xi \mapsto \xi|_U$ to denote this map.
Thus the rule $U \mapsto H^n(U, \mathcal{F})$ is a presheaf of
$\mathcal{O}$-modules. This presheaf is customarily denoted
$\underline{H}^n(\mathcal{F})$. We will give another interpretation
of this presheaf in Lemma \ref{lemma-include}.

\medskip\noindent
The following lemma says that it is possible to kill higher cohomology
classes by going to a covering.

\begin{lemma}
\label{lemma-kill-cohomology-class-on-covering}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}$ be a sheaf of $\mathcal{O}$-modules.
Let $U$ be an object of $\mathcal{C}$.
Let $n > 0$ and let $\xi \in H^n(U, \mathcal{F})$.
Then there exists a covering $\{U_i \to U\}$ of $\mathcal{C}$
such that $\xi|_{U_i} = 0$ for all $i \in I$.
\end{lemma}

\begin{proof}
Let $\mathcal{F} \to \mathcal{I}^\bullet$ be an injective resolution.
Then
$$
H^n(U, \mathcal{F}) =
\frac{\Ker(\mathcal{I}^n(U) \to \mathcal{I}^{n + 1}(U))}
{\Im(\mathcal{I}^{n - 1}(U) \to \mathcal{I}^n(U))}.
$$
Pick an element $\tilde \xi \in \mathcal{I}^n(U)$ representing the
cohomology class in the presentation above. Since $\mathcal{I}^\bullet$
is an injective resolution of $\mathcal{F}$ and $n > 0$ we see that
the complex $\mathcal{I}^\bullet$ is exact in degree $n$. Hence
$\Im(\mathcal{I}^{n - 1} \to \mathcal{I}^n) =
\Ker(\mathcal{I}^n \to \mathcal{I}^{n + 1})$ as sheaves.
Since $\tilde \xi$ is a section of the kernel sheaf over $U$
we conclude there exists a covering $\{U_i \to U\}$ of the site
such that $\tilde \xi|_{U_i}$ is the image under $d$ of a section
$\xi_i \in \mathcal{I}^{n - 1}(U_i)$. By our definition of the
restriction $\xi|_{U_i}$ as corresponding to the class of
$\tilde \xi|_{U_i}$ we conclude.
\end{proof}

\begin{lemma}
\label{lemma-higher-direct-images}
Let $f : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$ be a morphism of ringed sites
corresponding to the continuous functor $u : \mathcal{D} \to \mathcal{C}$.
For any $\mathcal{F} \in \Ob(\textit{Mod}(\mathcal{O}_\mathcal{C}))$
the sheaf $R^if_*\mathcal{F}$ is the sheaf associated to the
presheaf
$$
V \longmapsto H^i(u(V), \mathcal{F})
$$
\end{lemma}

\begin{proof}
Let $\mathcal{F} \to \mathcal{I}^\bullet$ be an injective resolution.
Then $R^if_*\mathcal{F}$ is by definition the $i$th cohomology sheaf
of the complex
$$
f_*\mathcal{I}^0 \to f_*\mathcal{I}^1 \to f_*\mathcal{I}^2 \to \ldots
$$
By definition of the abelian category structure on
$\mathcal{O}_\mathcal{D}$-modules
this cohomology sheaf is the sheaf associated to the presheaf
$$
V
\longmapsto
\frac{\Ker(f_*\mathcal{I}^i(V) \to f_*\mathcal{I}^{i + 1}(V))}
{\Im(f_*\mathcal{I}^{i - 1}(V) \to f_*\mathcal{I}^i(V))}
$$
and this is obviously equal to
$$
\frac{\Ker(\mathcal{I}^i(u(V)) \to \mathcal{I}^{i + 1}(u(V)))}
{\Im(\mathcal{I}^{i - 1}(u(V)) \to \mathcal{I}^i(u(V)))}
$$
which is equal to $H^i(u(V), \mathcal{F})$
and we win.
\end{proof}






\section{The {\v C}ech complex and {\v C}ech cohomology}
\label{section-cech}

\noindent
Let $\mathcal{C}$ be a category. Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$
be a family of morphisms with fixed target, see
Sites, Definition \ref{sites-definition-family-morphisms-fixed-target}.
Assume that all fibre products $U_{i_0} \times_U \ldots \times_U U_{i_p}$
exist in $\mathcal{C}$. Let $\mathcal{F}$ be an abelian presheaf on
$\mathcal{C}$. Set
$$
\check{\mathcal{C}}^p(\mathcal{U}, \mathcal{F})
=
\prod\nolimits_{(i_0, \ldots, i_p) \in I^{p + 1}}
\mathcal{F}(U_{i_0} \times_U \ldots \times_U U_{i_p}).
$$
This is an abelian group. For
$s \in \check{\mathcal{C}}^p(\mathcal{U}, \mathcal{F})$ we denote
$s_{i_0\ldots i_p}$ its value in the factor
$\mathcal{F}(U_{i_0} \times_U \ldots \times_U U_{i_p})$.
We define
$$
d : \check{\mathcal{C}}^p(\mathcal{U}, \mathcal{F})
\longrightarrow
\check{\mathcal{C}}^{p + 1}(\mathcal{U}, \mathcal{F})
$$
by the formula
\begin{equation}
\label{equation-d-cech}
d(s)_{i_0\ldots i_{p + 1}} =
\sum\nolimits_{j = 0}^{p + 1}
(-1)^j s_{i_0\ldots \hat i_j \ldots i_{p + 1}}
|_{U_{i_0} \times_U \ldots \times_U U_{i_{p + 1}}}
\end{equation}
where the restriction is via the projection map
$$
U_{i_0} \times_U \ldots \times_U U_{i_{p + 1}} \longrightarrow
U_{i_0} \times_U \ldots \times_U \widehat{U_{i_j}} \times_U
\ldots \times_U U_{i_{p + 1}}.
$$
It is straightforward to see that $d \circ d = 0$. In other words
$\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})$ is a complex.

\begin{definition}
\label{definition-cech-complex}
Let $\mathcal{C}$ be a category. Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$
be a family of morphisms with fixed target such that all fibre products
$U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in $\mathcal{C}$.
Let $\mathcal{F}$ be an abelian presheaf on $\mathcal{C}$.
The complex $\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})$
is the {\it {\v C}ech complex} associated to $\mathcal{F}$ and the
family $\mathcal{U}$. Its cohomology groups
$H^i(\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F}))$ are
called the {\it {\v C}ech cohomology groups} of $\mathcal{F}$ with respect
to $\mathcal{U}$. They are denoted $\check H^i(\mathcal{U}, \mathcal{F})$.
\end{definition}

\noindent
We observe that any covering $\{U_i \to U\}$ of a site $\mathcal{C}$
is a family of morphisms with fixed target to which the definition applies.

\begin{lemma}
\label{lemma-cech-h0}
Let $\mathcal{C}$ be a site.
Let $\mathcal{F}$ be an abelian presheaf on $\mathcal{C}$.
The following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is an abelian sheaf on $\mathcal{C}$ and
\item for every covering $\mathcal{U} = \{U_i \to U\}_{i \in I}$
of the site $\mathcal{C}$ the natural map
$$
\mathcal{F}(U) \to \check{H}^0(\mathcal{U}, \mathcal{F})
$$
(see Sites, Section \ref{sites-section-sheafification}) is bijective.
\end{enumerate}
\end{lemma}

\begin{proof}
This is true since the sheaf condition is exactly that
$\mathcal{F}(U) \to \check{H}^0(\mathcal{U}, \mathcal{F})$
is bijective for every covering of $\mathcal{C}$.
\end{proof}

\noindent
Let $\mathcal{C}$ be a category. Let $\mathcal{U} = \{U_i \to U\}_{i\in I}$
be a family of morphisms of $\mathcal{C}$ with fixed target such that
all fibre products $U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in
$\mathcal{C}$. Let $\mathcal{V} = \{V_j \to V\}_{j\in J}$ be another.
Let $f : U \to V$, $\alpha : I \to J$ and $f_i : U_i \to V_{\alpha(i)}$
be a morphism of families of morphisms with fixed target, see
Sites, Section \ref{sites-section-refinements}.
In this case we get a map of {\v C}ech complexes
\begin{equation}
\label{equation-map-cech-complexes}
\varphi : \check{\mathcal{C}}^\bullet(\mathcal{V}, \mathcal{F})
\longrightarrow
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})
\end{equation}
which in degree $p$ is given by
$$
\varphi(s)_{i_0 \ldots i_p} =
(f_{i_0} \times \ldots \times f_{i_p})^*s_{\alpha(i_0) \ldots \alpha(i_p)}
$$


\section{{\v C}ech cohomology as a functor on presheaves}
\label{section-cech-functor}

\noindent
Warning: In this section we work exclusively with abelian presheaves
on a category. The results are completely wrong in the
setting of sheaves and categories of sheaves!

\medskip\noindent
Let $\mathcal{C}$ be a category. Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$
be a family of morphisms with fixed target such that all fibre products
$U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in $\mathcal{C}$.
Let $\mathcal{F}$ be an abelian presheaf on $\mathcal{C}$.
The construction
$$
\mathcal{F} \longmapsto \check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})
$$
is functorial in $\mathcal{F}$. In fact, it is a functor
\begin{equation}
\label{equation-cech-functor}
\check{\mathcal{C}}^\bullet(\mathcal{U}, -) :
\textit{PAb}(\mathcal{C})
\longrightarrow
\text{Comp}^{+}(\textit{Ab})
\end{equation}
see
Derived Categories, Definition \ref{derived-definition-complexes-notation}
for notation. Recall that the category of bounded below complexes
in an abelian category is an abelian category, see
Homology, Lemma \ref{homology-lemma-cat-cochain-abelian}.

\begin{lemma}
\label{lemma-cech-exact-presheaves}
The functor given by Equation (\ref{equation-cech-functor})
is an exact functor (see Homology, Lemma \ref{homology-lemma-exact-functor}).
\end{lemma}

\begin{proof}
For any object $W$ of $\mathcal{C}$ the functor
$\mathcal{F} \mapsto \mathcal{F}(W)$ is an additive exact functor
from $\textit{PAb}(\mathcal{C})$ to $\textit{Ab}$.
The terms $\check{\mathcal{C}}^p(\mathcal{U}, \mathcal{F})$
of the complex are products of these exact functors and hence exact.
Moreover a sequence of complexes is exact if and only if the sequence
of terms in a given degree is exact. Hence the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-cech-cohomology-delta-functor-presheaves}
Let $\mathcal{C}$ be a category.
Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$ be a family of morphisms
with fixed target such that all fibre products
$U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in $\mathcal{C}$.
The functors $\mathcal{F} \mapsto \check{H}^n(\mathcal{U}, \mathcal{F})$
form a $\delta$-functor from the abelian category $\textit{PAb}(\mathcal{C})$
to the category of $\mathbf{Z}$-modules (see
Homology, Definition \ref{homology-definition-cohomological-delta-functor}).
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-cech-exact-presheaves}
a short exact sequence of abelian presheaves
$0 \to \mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3 \to 0$
is turned into a short exact sequence of complexes of
$\mathbf{Z}$-modules. Hence we can use
Homology, Lemma \ref{homology-lemma-long-exact-sequence-cochain}
to get the boundary maps
$\delta_{\mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3} :
\check{H}^n(\mathcal{U}, \mathcal{F}_3) \to
\check{H}^{n + 1}(\mathcal{U}, \mathcal{F}_1)$
and a corresponding long exact sequence. We omit the verification
that these maps are compatible with maps between short exact
sequences of presheaves.
\end{proof}

\begin{lemma}
\label{lemma-cech-map-into}
Let $\mathcal{C}$ be a category. Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$
be a family of morphisms with fixed target such that all fibre products
$U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in $\mathcal{C}$.
Consider the chain complex $\mathbf{Z}_{\mathcal{U}, \bullet}$
of abelian presheaves
$$
\ldots
\to
\bigoplus_{i_0i_1i_2} \mathbf{Z}_{U_{i_0} \times_U U_{i_1} \times_U U_{i_2}}
\to
\bigoplus_{i_0i_1} \mathbf{Z}_{U_{i_0} \times_U U_{i_1}}
\to
\bigoplus_{i_0} \mathbf{Z}_{U_{i_0}}
\to 0 \to \ldots
$$
where the last nonzero term is placed in degree $0$
and where the map
$$
\mathbf{Z}_{U_{i_0} \times_U \ldots \times_u U_{i_{p + 1}}}
\longrightarrow
\mathbf{Z}_{U_{i_0} \times_U
\ldots \widehat{U_{i_j}} \ldots \times_U U_{i_{p + 1}}}
$$
is given by $(-1)^j$ times the canonical map.
Then there is an isomorphism
$$
\Hom_{\textit{PAb}(\mathcal{C})}(\mathbf{Z}_{\mathcal{U}, \bullet}, \mathcal{F})
=
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})
$$
functorial in $\mathcal{F} \in \Ob(\textit{PAb}(\mathcal{C}))$.
\end{lemma}

\begin{proof}
This is a tautology based on the fact that
\begin{align*}
\Hom_{\textit{PAb}(\mathcal{C})}(
\bigoplus_{i_0 \ldots i_p}
\mathbf{Z}_{U_{i_0} \times_U \ldots \times_U U_{i_p}},
\mathcal{F})
& =
\prod_{i_0 \ldots i_p}
\Hom_{\textit{PAb}(\mathcal{C})}(
\mathbf{Z}_{U_{i_0} \times_U \ldots \times_U U_{i_p}},
\mathcal{F}) \\
& =
\prod_{i_0 \ldots i_p}
\mathcal{F}(U_{i_0} \times_U \ldots \times_U U_{i_p})
\end{align*}
see Modules on Sites, Lemma \ref{sites-modules-lemma-obvious-adjointness}.
\end{proof}

\begin{lemma}
\label{lemma-homology-complex}
Let $\mathcal{C}$ be a category. Let
$\mathcal{U} = \{f_i : U_i \to U\}_{i \in I}$ be a family of morphisms
with fixed target such that all fibre products
$U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in $\mathcal{C}$.
The chain complex $\mathbf{Z}_{\mathcal{U}, \bullet}$ of presheaves
of Lemma \ref{lemma-cech-map-into} above is exact in positive
degrees, i.e., the homology presheaves
$H_i(\mathbf{Z}_{\mathcal{U}, \bullet})$ are zero for $i > 0$.
\end{lemma}

\begin{proof}
Let $V$ be an object of $\mathcal{C}$. We have to show that the chain complex
of abelian groups $\mathbf{Z}_{\mathcal{U}, \bullet}(V)$ is exact in
degrees $> 0$. This is the complex
$$
\xymatrix{
\ldots \ar[d] \\
\bigoplus_{i_0i_1i_2}
\mathbf{Z}[
\Mor_\mathcal{C}(V, U_{i_0} \times_U U_{i_1} \times_U U_{i_2})
]
\ar[d] \\
\bigoplus_{i_0i_1}
\mathbf{Z}[
\Mor_\mathcal{C}(V, U_{i_0} \times_U U_{i_1})
]
\ar[d] \\
\bigoplus_{i_0}
\mathbf{Z}[
\Mor_\mathcal{C}(V, U_{i_0})
] \ar[d] \\
0
}
$$
For any morphism $\varphi : V \to U$ denote
$\Mor_\varphi(V, U_i) = \{\varphi_i : V \to U_i \mid
f_i \circ \varphi_i = \varphi\}$. We will use a similar notation
for $\Mor_\varphi(V, U_{i_0} \times_U \ldots \times_U U_{i_p})$.
Note that composing with the various projection maps between the
fibred products $U_{i_0} \times_U \ldots \times_U U_{i_p}$ preserves
these morphism sets. Hence we see that the complex above
is the same as the complex
$$
\xymatrix{
\ldots \ar[d] \\
\bigoplus_\varphi
\bigoplus_{i_0i_1i_2}
\mathbf{Z}[
\Mor_\varphi(V, U_{i_0} \times_U U_{i_1} \times_U U_{i_2})
]
\ar[d] \\
\bigoplus_\varphi
\bigoplus_{i_0i_1}
\mathbf{Z}[
\Mor_\varphi(V, U_{i_0} \times_U U_{i_1})
]
\ar[d] \\
\bigoplus_\varphi
\bigoplus_{i_0}
\mathbf{Z}[
\Mor_\varphi(V, U_{i_0})
] \ar[d] \\
0
}
$$
Next, we make the remark that we have
$$
\Mor_\varphi(V, U_{i_0} \times_U \ldots \times_U U_{i_p})
=
\Mor_\varphi(V, U_{i_0}) \times \ldots
\times \Mor_\varphi(V, U_{i_p})
$$
Using this and the fact that $\mathbf{Z}[A] \oplus \mathbf{Z}[B] =
\mathbf{Z}[A \amalg B]$ we see that the complex becomes
$$
\xymatrix{
\ldots \ar[d] \\
\bigoplus_\varphi
\mathbf{Z}\left[
\coprod_{i_0i_1i_2}
\Mor_\varphi(V, U_{i_0}) \times \Mor_\varphi(V, U_{i_1}) \times
\Mor_\varphi(V, U_{i_2})
\right]
\ar[d] \\
\bigoplus_\varphi
\mathbf{Z}\left[
\coprod_{i_0i_1}
\Mor_\varphi(V, U_{i_0}) \times \Mor_\varphi(V, U_{i_1})
\right]
\ar[d] \\
\bigoplus_\varphi
\mathbf{Z}\left[
\coprod_{i_0}
\Mor_\varphi(V, U_{i_0})
\right] \ar[d] \\
0
}
$$
Finally, on setting $S_\varphi = \coprod_{i \in I} \Mor_\varphi(V, U_i)$
we see that we get
$$
\bigoplus\nolimits_\varphi \left(\ldots \to
\mathbf{Z}[S_\varphi \times S_\varphi \times S_\varphi] \to
\mathbf{Z}[S_\varphi \times S_\varphi] \to
\mathbf{Z}[S_\varphi] \to 0 \to \ldots
\right)
$$
Thus we have simplified our task. Namely, it suffices to show that
for any nonempty set $S$ the (extended) complex of free abelian groups
$$
\ldots \to
\mathbf{Z}[S \times S \times S] \to
\mathbf{Z}[S \times S] \to
\mathbf{Z}[S] \xrightarrow{\Sigma} \mathbf{Z} \to 0 \to \ldots
$$
is exact in all degrees. To see this fix an element $s \in S$, and
use the homotopy
$$
n_{(s_0, \ldots, s_p)} \longmapsto n_{(s, s_0, \ldots, s_p)}
$$
with obvious notations.
\end{proof}

\begin{lemma}
\label{lemma-complex-tensored-still-exact}
\begin{slogan}
The integral presheaf {\v C}ech complex is a flat resolution of the
constant presheaf of integers.
\end{slogan}
Let $\mathcal{C}$ be a category. Let
$\mathcal{U} = \{f_i : U_i \to U\}_{i \in I}$ be a family of morphisms
with fixed target such that all fibre products
$U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in $\mathcal{C}$.
Let $\mathcal{O}$ be a presheaf of rings on $\mathcal{C}$.
The chain complex
$$
\mathbf{Z}_{\mathcal{U}, \bullet}
\otimes_{p, \mathbf{Z}}
\mathcal{O}
$$
is exact in positive degrees. Here $\mathbf{Z}_{\mathcal{U}, \bullet}$
is the chain complex of Lemma \ref{lemma-cech-map-into}, and
the tensor product is over the constant presheaf of rings
with value $\mathbf{Z}$.
\end{lemma}

\begin{proof}
Let $V$ be an object of $\mathcal{C}$.
In the proof of Lemma \ref{lemma-homology-complex} we saw that
$\mathbf{Z}_{\mathcal{U}, \bullet}(V)$ is isomorphic as a complex
to a direct sum of complexes which are homotopic to $\mathbf{Z}$
placed in degree zero. Hence also
$\mathbf{Z}_{\mathcal{U}, \bullet}(V) \otimes_\mathbf{Z} \mathcal{O}(V)$
is isomorphic as a complex to a direct sum of complexes which are homotopic
to $\mathcal{O}(V)$ placed in degree zero.
Or you can use
Modules on Sites, Lemma \ref{sites-modules-lemma-flat-resolution-of-flat},
which applies since the presheaves $\mathbf{Z}_{\mathcal{U}, i}$ are flat,
and the proof of Lemma \ref{lemma-homology-complex} shows that
$H_0(\mathbf{Z}_{\mathcal{U}, \bullet})$ is a flat presheaf also.
\end{proof}

\begin{lemma}
\label{lemma-cech-cohomology-derived-presheaves}
Let $\mathcal{C}$ be a category. Let
$\mathcal{U} = \{f_i : U_i \to U\}_{i \in I}$ be a family of morphisms
with fixed target such that all fibre products
$U_{i_0} \times_U \ldots \times_U U_{i_p}$ exist in $\mathcal{C}$.
The {\v C}ech cohomology functors $\check{H}^p(\mathcal{U}, -)$
are canonically isomorphic as a $\delta$-functor to
the right derived functors of the functor
$$
\check{H}^0(\mathcal{U}, -) :
\textit{PAb}(\mathcal{C})
\longrightarrow
\textit{Ab}.
$$
Moreover, there is a functorial quasi-isomorphism
$$
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})
\longrightarrow
R\check{H}^0(\mathcal{U}, \mathcal{F})
$$
where the right hand side indicates the derived functor
$$
R\check{H}^0(\mathcal{U}, -) :
D^{+}(\textit{PAb}(\mathcal{C}))
\longrightarrow
D^{+}(\mathbf{Z})
$$
of the left exact functor $\check{H}^0(\mathcal{U}, -)$.
\end{lemma}

\begin{proof}
Note that the category of abelian presheaves has enough injectives, see
Injectives, Proposition \ref{injectives-proposition-presheaves-injectives}.
Note that $\check{H}^0(\mathcal{U}, -)$ is a left exact functor
from the category of abelian presheaves
to the category of $\mathbf{Z}$-modules.
Hence the derived functor and the right derived functor exist, see
Derived Categories, Section \ref{derived-section-right-derived-functor}.

\medskip\noindent
Let $\mathcal{I}$ be a injective abelian presheaf.
In this case the functor
$\Hom_{\textit{PAb}(\mathcal{C})}(-, \mathcal{I})$
is exact on $\textit{PAb}(\mathcal{C})$. By
Lemma \ref{lemma-cech-map-into} we have
$$
\Hom_{\textit{PAb}(\mathcal{C})}(
\mathbf{Z}_{\mathcal{U}, \bullet}, \mathcal{I})
=
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}).
$$
By Lemma \ref{lemma-homology-complex} we have that
$\mathbf{Z}_{\mathcal{U}, \bullet}$ is exact in positive degrees.
Hence by the exactness of Hom into $\mathcal{I}$ mentioned above we see
that $\check{H}^i(\mathcal{U}, \mathcal{I}) = 0$ for all
$i > 0$. Thus the $\delta$-functor $(\check{H}^n, \delta)$
(see Lemma \ref{lemma-cech-cohomology-delta-functor-presheaves})
satisfies the assumptions of
Homology, Lemma \ref{homology-lemma-efface-implies-universal},
and hence is a universal $\delta$-functor.

\medskip\noindent
By
Derived Categories, Lemma \ref{derived-lemma-higher-derived-functors}
also the sequence $R^i\check{H}^0(\mathcal{U}, -)$
forms a universal $\delta$-functor. By the uniqueness of universal
$\delta$-functors, see
Homology, Lemma \ref{homology-lemma-uniqueness-universal-delta-functor}
we conclude that
$R^i\check{H}^0(\mathcal{U}, -) = \check{H}^i(\mathcal{U}, -)$.
This is enough for most applications
and the reader is suggested to skip the rest of the proof.

\medskip\noindent
Let $\mathcal{F}$ be any abelian presheaf on $\mathcal{C}$.
Choose an injective resolution $\mathcal{F} \to \mathcal{I}^\bullet$
in the category $\textit{PAb}(\mathcal{C})$.
Consider the double complex
$\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet)$
with terms $\check{\mathcal{C}}^p(\mathcal{U}, \mathcal{I}^q)$.
Next, consider the total complex
$\text{Tot}(\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet))$
associated to this double complex, see
Homology, Section \ref{homology-section-double-complexes}.
There is a map of complexes
$$
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})
\longrightarrow
\text{Tot}(\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet))
$$
coming from the maps
$\check{\mathcal{C}}^p(\mathcal{U}, \mathcal{F})
\to \check{\mathcal{C}}^p(\mathcal{U}, \mathcal{I}^0)$
and there is a map of complexes
$$
\check{H}^0(\mathcal{U}, \mathcal{I}^\bullet)
\longrightarrow
\text{Tot}(\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet))
$$
coming from the maps
$\check{H}^0(\mathcal{U}, \mathcal{I}^q) \to
\check{\mathcal{C}}^0(\mathcal{U}, \mathcal{I}^q)$.
Both of these maps are quasi-isomorphisms by an application of
Homology, Lemma \ref{homology-lemma-double-complex-gives-resolution}.
Namely, the columns of the double complex are exact in positive degrees
because the {\v C}ech complex as a functor is exact
(Lemma \ref{lemma-cech-exact-presheaves})
and the rows of the double complex are exact in positive degrees
since as we just saw the higher {\v C}ech cohomology groups of the injective
presheaves $\mathcal{I}^q$ are zero.
Since quasi-isomorphisms become invertible
in $D^{+}(\mathbf{Z})$ this gives the last displayed morphism
of the lemma. We omit the verification that this morphism is
functorial.
\end{proof}





\section{{\v C}ech cohomology and cohomology}
\label{section-cech-cohomology-cohomology}

\noindent
The relationship between cohomology and {\v C}ech cohomology comes from the fact
that the {\v C}ech cohomology of an injective abelian sheaf is zero. To see this
we note that an injective abelian sheaf is an injective abelian presheaf and
then we apply results in {\v C}ech cohomology in the preceding section.

\begin{lemma}
\label{lemma-injective-abelian-sheaf-injective-presheaf}
Let $\mathcal{C}$ be a site. An injective abelian sheaf is also injective as an
object in the category $\textit{PAb}(\mathcal{C})$.
\end{lemma}

\begin{proof}
Apply Homology, Lemma \ref{homology-lemma-adjoint-preserve-injectives}
to the categories $\mathcal{A} = \textit{Ab}(\mathcal{C})$,
$\mathcal{B} = \textit{PAb}(\mathcal{C})$, the inclusion functor
and sheafification. (See
Modules on Sites, Section \ref{sites-modules-section-abelian-sheaves} to see
that all assumptions of the lemma are satisfied.)
\end{proof}

\begin{lemma}
\label{lemma-injective-trivial-cech}
Let $\mathcal{C}$ be a site.
Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$ be a covering of $\mathcal{C}$.
Let $\mathcal{I}$ be an injective abelian sheaf, i.e., an injective
object of $\textit{Ab}(\mathcal{C})$.
Then
$$
\check{H}^p(\mathcal{U}, \mathcal{I}) =
\left\{
\begin{matrix}
\mathcal{I}(U) & \text{if} & p = 0 \\
0 & \text{if} & p > 0
\end{matrix}
\right.
$$
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-injective-abelian-sheaf-injective-presheaf}
we see that $\mathcal{I}$ is an injective object in
$\textit{PAb}(\mathcal{C})$.
Hence we can apply Lemma \ref{lemma-cech-cohomology-derived-presheaves}
(or its proof) to see the vanishing of higher {\v C}ech cohomology group.
For the zeroth see Lemma \ref{lemma-cech-h0}.
\end{proof}

\begin{lemma}
\label{lemma-cech-cohomology}
Let $\mathcal{C}$ be a site.
Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$ be a covering of $\mathcal{C}$.
There is a transformation
$$
\check{\mathcal{C}}^\bullet(\mathcal{U}, -)
\longrightarrow
R\Gamma(U, -)
$$
of functors
$\textit{Ab}(\mathcal{C}) \to D^{+}(\mathbf{Z})$.
In particular this gives a transformation of functors
$\check{H}^p(U, \mathcal{F}) \to H^p(U, \mathcal{F})$ for
$\mathcal{F}$ ranging over $\textit{Ab}(\mathcal{C})$.
\end{lemma}

\begin{proof}
Let $\mathcal{F}$ be an abelian sheaf. Choose an injective resolution
$\mathcal{F} \to \mathcal{I}^\bullet$. Consider the double complex
$\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet)$
with terms $\check{\mathcal{C}}^p(\mathcal{U}, \mathcal{I}^q)$.
Next, consider the associated total complex
$\text{Tot}(\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet))$,
see Homology, Definition \ref{homology-definition-associated-simple-complex}.
There is a map of complexes
$$
\alpha :
\Gamma(U, \mathcal{I}^\bullet)
\longrightarrow
\text{Tot}(\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet))
$$
coming from the maps
$\mathcal{I}^q(U) \to \check{H}^0(\mathcal{U}, \mathcal{I}^q)$
and a map of complexes
$$
\beta :
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})
\longrightarrow
\text{Tot}(\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet))
$$
coming from the map $\mathcal{F} \to \mathcal{I}^0$.
We can apply
Homology, Lemma \ref{homology-lemma-double-complex-gives-resolution}
to see that $\alpha$ is a quasi-isomorphism.
Namely, Lemma \ref{lemma-injective-trivial-cech} implies that
the $q$th row of the double complex
$\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}^\bullet)$ is a
resolution of $\Gamma(U, \mathcal{I}^q)$.
Hence $\alpha$ becomes invertible in $D^{+}(\mathbf{Z})$ and
the transformation of the lemma is the composition of $\beta$
followed by the inverse of $\alpha$. We omit the verification
that this is functorial.
\end{proof}

\begin{lemma}
\label{lemma-cech-h1}
Let $\mathcal{C}$ be a site. Let $\mathcal{G}$ be an abelian sheaf
on $\mathcal{C}$. Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$ be a
covering of $\mathcal{C}$. The map
$$
\check{H}^1(\mathcal{U}, \mathcal{G})
\longrightarrow
H^1(U, \mathcal{G})
$$
is injective and identifies $\check{H}^1(\mathcal{U}, \mathcal{G})$ via
the bijection of Lemma \ref{lemma-torsors-h1}
with the set of isomorphism classes of $\mathcal{G}|_U$-torsors
which restrict to trivial torsors over each $U_i$.
\end{lemma}

\begin{proof}
To see this we construct an inverse map. Namely, let $\mathcal{F}$ be a
$\mathcal{G}|_U$-torsor on $\mathcal{C}/U$ whose restriction to
$\mathcal{C}/U_i$ is trivial. By Lemma \ref{lemma-trivial-torsor}
this means there
exists a section $s_i \in \mathcal{F}(U_i)$. On $U_{i_0} \times_U U_{i_1}$
there is a unique section $s_{i_0i_1}$ of $\mathcal{G}$ such that
$s_{i_0i_1} \cdot s_{i_0}|_{U_{i_0} \times_U U_{i_1}} =
s_{i_1}|_{U_{i_0} \times_U U_{i_1}}$. An easy computation shows
that $s_{i_0i_1}$ is a {\v C}ech cocycle and that its class is well
defined (i.e., does not depend on the choice of the sections $s_i$).
The inverse maps the isomorphism class of $\mathcal{F}$ to the cohomology
class of the cocycle $(s_{i_0i_1})$.
We omit the verification that this map is indeed an inverse.
\end{proof}

\begin{lemma}
\label{lemma-include}
Let $\mathcal{C}$ be a site.
Consider the functor
$i : \textit{Ab}(\mathcal{C}) \to \textit{PAb}(\mathcal{C})$.
It is a left exact functor with right derived functors given by
$$
R^pi(\mathcal{F}) = \underline{H}^p(\mathcal{F}) :
U \longmapsto H^p(U, \mathcal{F})
$$
see discussion in Section \ref{section-locality}.
\end{lemma}

\begin{proof}
It is clear that $i$ is left exact.
Choose an injective resolution $\mathcal{F} \to \mathcal{I}^\bullet$.
By definition $R^pi$ is the $p$th cohomology {\it presheaf}
of the complex $\mathcal{I}^\bullet$. In other words, the
sections of $R^pi(\mathcal{F})$ over an object $U$ of $\mathcal{C}$
are given by
$$
\frac{\Ker(\mathcal{I}^n(U) \to \mathcal{I}^{n + 1}(U))}
{\Im(\mathcal{I}^{n - 1}(U) \to \mathcal{I}^n(U))}.
$$
which is the definition of $H^p(U, \mathcal{F})$.
\end{proof}

\begin{lemma}
\label{lemma-cech-spectral-sequence}
Let $\mathcal{C}$ be a site. Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$
be a covering of $\mathcal{C}$. For any abelian sheaf $\mathcal{F}$ there
is a spectral sequence $(E_r, d_r)_{r \geq 0}$ with
$$
E_2^{p, q} = \check{H}^p(\mathcal{U}, \underline{H}^q(\mathcal{F}))
$$
converging to $H^{p + q}(U, \mathcal{F})$.
This spectral sequence is functorial in $\mathcal{F}$.
\end{lemma}

\begin{proof}
This is a Grothendieck spectral sequence (see
Derived Categories, Lemma \ref{derived-lemma-grothendieck-spectral-sequence})
for the functors
$$
i :  \textit{Ab}(\mathcal{C}) \to \textit{PAb}(\mathcal{C})
\quad\text{and}\quad
\check{H}^0(\mathcal{U}, - ) : \textit{PAb}(\mathcal{C})
\to \textit{Ab}.
$$
Namely, we have $\check{H}^0(\mathcal{U}, i(\mathcal{F})) = \mathcal{F}(U)$
by Lemma \ref{lemma-cech-h0}. We have that $i(\mathcal{I})$ is
{\v C}ech acyclic by Lemma \ref{lemma-injective-trivial-cech}. And we
have that $\check{H}^p(\mathcal{U}, -) = R^p\check{H}^0(\mathcal{U}, -)$
as functors on $\textit{PAb}(\mathcal{C})$
by Lemma \ref{lemma-cech-cohomology-derived-presheaves}.
Putting everything together gives the lemma.
\end{proof}

\begin{lemma}
\label{lemma-cech-spectral-sequence-application}
Let $\mathcal{C}$ be a site.
Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$ be a covering.
Let $\mathcal{F} \in \Ob(\textit{Ab}(\mathcal{C}))$.
Assume that $H^i(U_{i_0} \times_U \ldots \times_U U_{i_p}, \mathcal{F}) = 0$
for all $i > 0$, all $p \geq 0$ and all $i_0, \ldots, i_p \in I$.
Then $\check{H}^p(\mathcal{U}, \mathcal{F}) = H^p(U, \mathcal{F})$.
\end{lemma}

\begin{proof}
We will use the spectral sequence of
Lemma \ref{lemma-cech-spectral-sequence}.
The assumptions mean that $E_2^{p, q} = 0$ for all $(p, q)$ with
$q \not = 0$. Hence the spectral sequence degenerates at $E_2$
and the result follows.
\end{proof}

\begin{lemma}
\label{lemma-ses-cech-h1}
Let $\mathcal{C}$ be a site.
Let
$$
0 \to \mathcal{F} \to \mathcal{G} \to \mathcal{H} \to 0
$$
be a short exact sequence of abelian sheaves on $\mathcal{C}$.
Let $U$ be an object of $\mathcal{C}$. If there exists a cofinal system
of coverings $\mathcal{U}$ of $U$ such that
$\check{H}^1(\mathcal{U}, \mathcal{F}) = 0$,
then the map $\mathcal{G}(U) \to \mathcal{H}(U)$ is
surjective.
\end{lemma}

\begin{proof}
Take an element $s \in \mathcal{H}(U)$. Choose a covering
$\mathcal{U} = \{U_i \to U\}_{i \in I}$ such that
(a) $\check{H}^1(\mathcal{U}, \mathcal{F}) = 0$ and (b)
$s|_{U_i}$ is the image of a section $s_i \in \mathcal{G}(U_i)$.
Since we can certainly find a covering such that (b) holds
it follows from the assumptions of the lemma that we can find
a covering such that (a) and (b) both hold.
Consider the sections
$$
s_{i_0i_1} =
s_{i_1}|_{U_{i_0} \times_U U_{i_1}} - s_{i_0}|_{U_{i_0} \times_U U_{i_1}}.
$$
Since $s_i$ lifts $s$ we see that
$s_{i_0i_1} \in \mathcal{F}(U_{i_0} \times_U U_{i_1})$.
By the vanishing of $\check{H}^1(\mathcal{U}, \mathcal{F})$ we can
find sections $t_i \in \mathcal{F}(U_i)$ such that
$$
s_{i_0i_1} =
t_{i_1}|_{U_{i_0} \times_U U_{i_1}} - t_{i_0}|_{U_{i_0} \times_U U_{i_1}}.
$$
Then clearly the sections $s_i - t_i$ satisfy the sheaf condition
and glue to a section of $\mathcal{G}$ over $U$ which maps to $s$.
Hence we win.
\end{proof}

\begin{lemma}
\label{lemma-cech-vanish-collection}
(Variant of Cohomology, Lemma \ref{cohomology-lemma-cech-vanish}.)
Let $\mathcal{C}$ be a site. Let $\text{Cov}_\mathcal{C}$ be the set
of coverings of $\mathcal{C}$ (see
Sites, Definition \ref{sites-definition-site}). Let
$\mathcal{B} \subset \Ob(\mathcal{C})$, and
$\text{Cov} \subset \text{Cov}_\mathcal{C}$
be subsets. Let $\mathcal{F}$ be an abelian sheaf on $\mathcal{C}$.
Assume that
\begin{enumerate}
\item For every $\mathcal{U} \in \text{Cov}$,
$\mathcal{U} = \{U_i \to U\}_{i \in I}$ we have
$U, U_i \in \mathcal{B}$ and every
$U_{i_0} \times_U \ldots \times_U U_{i_p} \in \mathcal{B}$.
\item For every $U \in \mathcal{B}$ the coverings of $U$
occurring in $\text{Cov}$ is a cofinal system of coverings of $U$.
\item For every $\mathcal{U} \in \text{Cov}$ we have
$\check{H}^p(\mathcal{U}, \mathcal{F}) = 0$ for all $p > 0$.
\end{enumerate}
Then $H^p(U, \mathcal{F}) = 0$ for all $p > 0$ and any $U \in \mathcal{B}$.
\end{lemma}

\begin{proof}
Let $\mathcal{F}$ and $\text{Cov}$ be as in the lemma.
We will indicate this by saying ``$\mathcal{F}$ has vanishing higher
{\v C}ech cohomology for any $\mathcal{U} \in \text{Cov}$''.
Choose an embedding $\mathcal{F} \to \mathcal{I}$ into an
injective abelian sheaf.
By Lemma \ref{lemma-injective-trivial-cech} $\mathcal{I}$
has vanishing higher {\v C}ech cohomology for any $\mathcal{U} \in \text{Cov}$.
Let $\mathcal{Q} = \mathcal{I}/\mathcal{F}$
so that we have a short exact sequence
$$
0 \to \mathcal{F} \to \mathcal{I} \to \mathcal{Q} \to 0.
$$
By Lemma \ref{lemma-ses-cech-h1} and our assumption (2)
this sequence gives rise to an exact sequence
$$
0 \to \mathcal{F}(U) \to \mathcal{I}(U) \to \mathcal{Q}(U) \to 0.
$$
for every $U \in \mathcal{B}$. Hence for any $\mathcal{U} \in \text{Cov}$
we get a short exact sequence of {\v C}ech complexes
$$
0 \to
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F}) \to
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}) \to
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{Q}) \to 0
$$
since each term in the {\v C}ech complex is made up out of a product of
values over elements of $\mathcal{B}$ by assumption (1).
In particular we have a long exact sequence of {\v C}ech cohomology
groups for any covering $\mathcal{U} \in \text{Cov}$.
This implies that $\mathcal{Q}$ is also an abelian sheaf
with vanishing higher {\v C}ech cohomology for all
$\mathcal{U} \in \text{Cov}$.

\medskip\noindent
Next, we look at the long exact cohomology sequence
$$
\xymatrix{
0 \ar[r] &
H^0(U, \mathcal{F}) \ar[r] &
H^0(U, \mathcal{I}) \ar[r] &
H^0(U, \mathcal{Q}) \ar[lld] \\
&
H^1(U, \mathcal{F}) \ar[r] &
H^1(U, \mathcal{I}) \ar[r] &
H^1(U, \mathcal{Q}) \ar[lld] \\
&
\ldots & \ldots & \ldots \\
}
$$
for any $U \in \mathcal{B}$. Since $\mathcal{I}$ is injective we
have $H^n(U, \mathcal{I}) = 0$ for $n > 0$ (see
Derived Categories, Lemma \ref{derived-lemma-higher-derived-functors}).
By the above we see that $H^0(U, \mathcal{I}) \to H^0(U, \mathcal{Q})$
is surjective and hence $H^1(U, \mathcal{F}) = 0$.
Since $\mathcal{F}$ was an arbitrary abelian sheaf with
vanishing higher {\v C}ech cohomology for all $\mathcal{U} \in \text{Cov}$
we conclude that also $H^1(U, \mathcal{Q}) = 0$ since $\mathcal{Q}$ is
another of these sheaves (see above). By the long exact sequence this in
turn implies that $H^2(U, \mathcal{F}) = 0$. And so on and so forth.
\end{proof}














\section{Second cohomology and gerbes}
\label{section-gerbes}

\noindent
Let $p : \mathcal{S} \to \mathcal{C}$ be a gerbe over a site
all of whose automorphism groups are commutative. In this situation
the first and second cohomology groups of the sheaf of automorphisms
(Stacks, Lemma \ref{stacks-lemma-gerbe-abelian-auts})
controls the existence of objects.

\medskip\noindent
The following lemma will be made obsolete by a more complete
discussion of this relationship we will add in the future.

\begin{lemma}
\label{lemma-existence}
Let $\mathcal{C}$ be a site. Let $p : \mathcal{S} \to \mathcal{C}$
be a gerbe over a site whose automorphism sheaves are abelian.
Let $\mathcal{G}$ be the sheaf of abelian groups constructed
in Stacks, Lemma \ref{stacks-lemma-gerbe-abelian-auts}.
Let $U$ be an object of $\mathcal{C}$ such that
\begin{enumerate}
\item there exists a cofinal system of coverings $\{U_i \to U\}$
of $U$ in $\mathcal{C}$ such that $H^1(U_i, \mathcal{G}) = 0$ and
$H^1(U_i \times_U U_j, \mathcal{G}) = 0$
for all $i, j$, and
\item $H^2(U, \mathcal{G}) = 0$.
\end{enumerate}
Then there exists an object of $\mathcal{S}$ lying over $U$.
\end{lemma}

\begin{proof}
By Stacks, Definition \ref{stacks-definition-gerbe}
there exists a covering $\mathcal{U} = \{U_i \to U\}$
and $x_i$ in $\mathcal{S}$ lying over $U_i$.
Write $U_{ij} = U_i \times_U U_j$. By (1) after refining the covering
we may assume that $H^1(U_i, \mathcal{G}) = 0$ and
$H^1(U_{ij}, \mathcal{G}) = 0$.
Consider the sheaf
$$
\mathcal{F}_{ij} =
\mathit{Isom}(x_i|_{U_{ij}}, x_j|_{U_{ij}})
$$
on $\mathcal{C}/U_{ij}$. Since
$\mathcal{G}|_{U_{ij}} = \mathit{Aut}(x_i|_{U_{ij}})$ we see that there
is an action
$$
\mathcal{G}|_{U_{ij}} \times \mathcal{F}_{ij} \to \mathcal{F}_{ij}
$$
by precomposition. It is clear that $\mathcal{F}_{ij}$ is a
pseudo $\mathcal{G}|_{U_{ij}}$-torsor and in fact a torsor because
any two objects of a gerbe are locally isomorphic.
By our choice of the covering and by
Lemma \ref{lemma-torsors-h1}
these torsors are trivial (and hence have global sections by
Lemma \ref{lemma-trivial-torsor}).
In other words, we can choose isomorphisms
$$
\varphi_{ij} : x_i|_{U_{ij}} \longrightarrow x_j|_{U_{ij}}
$$
To find an object $x$ over $U$ we are going to massage our choice
of these $\varphi_{ij}$ to get a descent datum (which is necessarily
effective as $p : \mathcal{S} \to \mathcal{C}$ is a stack).
Namely, the obstruction to being a descent datum is that the cocycle
condition may not hold. Namely, set $U_{ijk} = U_i \times_U U_j \times_U U_k$.
Then we can consider
$$
g_{ijk} = \varphi_{ik}^{-1}|_{U_{ijk}} \circ \varphi_{jk}|_{U_{ijk}} \circ
\varphi_{ij}|_{U_{ijk}}
$$
which is an automorphism of $x_i$ over $U_{ijk}$. Thus we may and do
consider $g_{ijk}$ as a section of $\mathcal{G}$ over $U_{ijk}$.
A computation (omitted) shows that $(g_{i_0i_1i_2})$ is a $2$-cocycle
in the {\v C}ech complex ${\check C}^\bullet(\mathcal{U}, \mathcal{G})$
of $\mathcal{G}$ with respect to the covering $\mathcal{U}$.
By the spectral sequence of
Lemma \ref{lemma-cech-spectral-sequence}
and since $H^1(U_i, \mathcal{G}) = 0$ for all $i$
we see that ${\check H}^2(\mathcal{U}, \mathcal{G}) \to H^2(U, \mathcal{G})$
is injective. Hence $(g_{i_0i_1i_2})$ is a coboundary
by our assumption that $H^2(U, \mathcal{G}) = 0$.
Thus we can find sections $g_{ij} \in \mathcal{G}(U_{ij})$ such that
$g_{ik}^{-1}|_{U_{ijk}} g_{jk}|_{U_{ijk}}  g_{ij}|_{U_{ijk}} = g_{ijk}$
for all $i, j, k$.
After replacing $\varphi_{ij}$ by $\varphi_{ij}g_{ij}^{-1}$
we see that $\varphi_{ij}$ gives a descent datum on the objects
$x_i$ over $U_i$ and the proof is complete.
\end{proof}












\section{Cohomology of modules}
\label{section-cohomology-modules}

\noindent
Everything that was said for cohomology of abelian sheaves
goes for cohomology of modules, since the two agree.

\begin{lemma}
\label{lemma-injective-module-injective-presheaf}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
An injective sheaf of modules is also injective as an
object in the category $\textit{PMod}(\mathcal{O})$.
\end{lemma}

\begin{proof}
Apply Homology, Lemma \ref{homology-lemma-adjoint-preserve-injectives}
to the categories $\mathcal{A} = \textit{Mod}(\mathcal{O})$,
$\mathcal{B} = \textit{PMod}(\mathcal{O})$, the inclusion functor
and sheafification. (See
Modules on Sites,
Section \ref{sites-modules-section-sheafification-presheaves-modules}
to see that all assumptions of the lemma are satisfied.)
\end{proof}

\begin{lemma}
\label{lemma-include-modules}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Consider the functor
$i : \textit{Mod}(\mathcal{C}) \to \textit{PMod}(\mathcal{C})$.
It is a left exact functor with right derived functors given by
$$
R^pi(\mathcal{F}) = \underline{H}^p(\mathcal{F}) :
U \longmapsto H^p(U, \mathcal{F})
$$
see discussion in
Section \ref{section-locality}.
\end{lemma}

\begin{proof}
It is clear that $i$ is left exact.
Choose an injective resolution $\mathcal{F} \to \mathcal{I}^\bullet$
in $\textit{Mod}(\mathcal{O})$.
By definition $R^pi$ is the $p$th cohomology {\it presheaf}
of the complex $\mathcal{I}^\bullet$. In other words, the
sections of $R^pi(\mathcal{F})$ over an object $U$ of $\mathcal{C}$
are given by
$$
\frac{\Ker(\mathcal{I}^n(U) \to \mathcal{I}^{n + 1}(U))}
{\Im(\mathcal{I}^{n - 1}(U) \to \mathcal{I}^n(U))}.
$$
which is the definition of $H^p(U, \mathcal{F})$.
\end{proof}

\begin{lemma}
\label{lemma-injective-module-trivial-cech}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{U} = \{U_i \to U\}_{i \in I}$ be a covering of $\mathcal{C}$.
Let $\mathcal{I}$ be an injective $\mathcal{O}$-module, i.e., an injective
object of $\textit{Mod}(\mathcal{O})$. Then
$$
\check{H}^p(\mathcal{U}, \mathcal{I}) =
\left\{
\begin{matrix}
\mathcal{I}(U) & \text{if} & p = 0 \\
0 & \text{if} & p > 0
\end{matrix}
\right.
$$
\end{lemma}

\begin{proof}
Lemma \ref{lemma-cech-map-into} gives the first equality in the following
sequence of equalities
\begin{align*}
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I})
& =
\Mor_{\textit{PAb}(\mathcal{C})}(
\mathbf{Z}_{\mathcal{U}, \bullet}, \mathcal{I}) \\
& =
\Mor_{\textit{PMod}(\mathbf{Z})}(
\mathbf{Z}_{\mathcal{U}, \bullet}, \mathcal{I}) \\
& =
\Mor_{\textit{PMod}(\mathcal{O})}(
\mathbf{Z}_{\mathcal{U}, \bullet} \otimes_{p, \mathbf{Z}} \mathcal{O},
\mathcal{I})
\end{align*}
The third equality by
Modules on Sites,
Lemma \ref{sites-modules-lemma-adjointness-tensor-restrict-presheaves}.
By Lemma \ref{lemma-injective-module-injective-presheaf}
we see that $\mathcal{I}$ is an injective object in
$\textit{PMod}(\mathcal{O})$.
Hence $\Hom_{\textit{PMod}(\mathcal{O})}(-, \mathcal{I})$
is an exact functor. By
Lemma \ref{lemma-complex-tensored-still-exact} we see the vanishing of
higher {\v C}ech cohomology groups.
For the zeroth see Lemma \ref{lemma-cech-h0}.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-modules-abelian-agree}
Let $\mathcal{C}$ be a site.
Let $\mathcal{O}$ be a sheaf of rings on $\mathcal{C}$.
Let $\mathcal{F}$ be an $\mathcal{O}$-module, and denote
$\mathcal{F}_{ab}$ the underlying sheaf of abelian groups.
Then we have
$$
H^i(\mathcal{C}, \mathcal{F}_{ab})
=
H^i(\mathcal{C}, \mathcal{F})
$$
and for any object $U$ of $\mathcal{C}$ we also have
$$
H^i(U, \mathcal{F}_{ab})
=
H^i(U, \mathcal{F}).
$$
Here the left hand side is cohomology computed in
$\textit{Ab}(\mathcal{C})$ and the right hand side
is cohomology computed in $\textit{Mod}(\mathcal{O})$.
\end{lemma}

\begin{proof}
By
Derived Categories, Lemma \ref{derived-lemma-higher-derived-functors}
the $\delta$-functor $(\mathcal{F} \mapsto H^p(U, \mathcal{F}))_{p \geq 0}$
is universal. The functor
$\textit{Mod}(\mathcal{O}) \to \textit{Ab}(\mathcal{C})$,
$\mathcal{F} \mapsto \mathcal{F}_{ab}$ is exact. Hence
$(\mathcal{F} \mapsto H^p(U, \mathcal{F}_{ab}))_{p \geq 0}$
is a $\delta$-functor also. Suppose we show that
$(\mathcal{F} \mapsto H^p(U, \mathcal{F}_{ab}))_{p \geq 0}$
is also universal. This will imply the second statement of the lemma
by uniqueness of universal $\delta$-functors, see
Homology, Lemma \ref{homology-lemma-uniqueness-universal-delta-functor}.
Since $\textit{Mod}(\mathcal{O})$ has enough injectives,
it suffices to show that $H^i(U, \mathcal{I}_{ab}) = 0$
for any injective object $\mathcal{I}$ in $\textit{Mod}(\mathcal{O})$, see
Homology, Lemma \ref{homology-lemma-efface-implies-universal}.

\medskip\noindent
Let $\mathcal{I}$ be an injective object of $\textit{Mod}(\mathcal{O})$.
Apply Lemma \ref{lemma-cech-vanish-collection}
with $\mathcal{F} = \mathcal{I}$, $\mathcal{B} = \mathcal{C}$
and $\text{Cov} = \text{Cov}_\mathcal{C}$.
Assumption (3) of that lemma holds by
Lemma \ref{lemma-injective-module-trivial-cech}.
Hence we see that $H^i(U, \mathcal{I}_{ab}) = 0$
for every object $U$ of $\mathcal{C}$.

\medskip\noindent
If $\mathcal{C}$ has a final
object then this also implies the first equality. If not, then
according to Sites, Lemma \ref{sites-lemma-topos-good-site} we see that
the ringed topos $(\Sh(\mathcal{C}), \mathcal{O})$ is equivalent to a
ringed topos where the underlying site does have a final object.
Hence the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-products}
Let $\mathcal{C}$ be a site. Let $I$ be a set. For $i \in I$ let 
$\mathcal{F}_i$ be an abelian sheaf on $\mathcal{C}$. Let
$U \in \Ob(\mathcal{C})$. The canonical map
$$
H^p(U, \prod\nolimits_{i \in I} \mathcal{F}_i)
\longrightarrow
\prod\nolimits_{i \in I} H^p(U, \mathcal{F}_i)
$$
is an isomorphism for $p = 0$ and injective for $p = 1$.
\end{lemma}

\begin{proof}
The statement for $p = 0$ is true because the product of sheaves
is equal to the product of the underlying presheaves, see
Sites, Lemma \ref{sites-lemma-limit-sheaf}.
Proof for $p = 1$. Set $\mathcal{F} = \prod \mathcal{F}_i$.
Let $\xi \in H^1(U, \mathcal{F})$ map to zero in
$\prod H^1(U, \mathcal{F}_i)$. By locality of cohomology, see
Lemma \ref{lemma-kill-cohomology-class-on-covering},
there exists a covering $\mathcal{U} = \{U_j \to U\}$ such that
$\xi|_{U_j} = 0$ for all $j$. By Lemma \ref{lemma-cech-h1} this means
$\xi$ comes from an element
$\check \xi \in \check H^1(\mathcal{U}, \mathcal{F})$.
Since the maps
$\check H^1(\mathcal{U}, \mathcal{F}_i) \to H^1(U, \mathcal{F}_i)$
are injective for all $i$ (by Lemma \ref{lemma-cech-h1}), and since
the image of $\xi$ is zero in $\prod H^1(U, \mathcal{F}_i)$ we see
that the image
$\check \xi_i = 0$ in $\check H^1(\mathcal{U}, \mathcal{F}_i)$.
However, since $\mathcal{F} = \prod \mathcal{F}_i$ we see that
$\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F})$ is the
product of the complexes
$\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F}_i)$,
hence by
Homology, Lemma \ref{homology-lemma-product-abelian-groups-exact}
we conclude that $\check \xi = 0$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-restriction-along-monomorphism-surjective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $a : U' \to U$ be a
monomorphism in $\mathcal{C}$. Then for any injective $\mathcal{O}$-module
$\mathcal{I}$ the restriction mapping $\mathcal{I}(U) \to \mathcal{I}(U')$
is surjective.
\end{lemma}

\begin{proof}
Let $j : \mathcal{C}/U \to \mathcal{C}$ and
$j' : \mathcal{C}/U' \to \mathcal{C}$ be the localization morphisms
(Modules on Sites, Section \ref{sites-modules-section-localize}).
Since $j_!$ is a left adjoint to restriction we see that
for any sheaf $\mathcal{F}$ of $\mathcal{O}$-modules
$$
\Hom_\mathcal{O}(j_!\mathcal{O}_U, \mathcal{F})
=
\Hom_{\mathcal{O}_U}(\mathcal{O}_U, \mathcal{F}|_U)
=
\mathcal{F}(U)
$$
Similarly, the sheaf $j'_!\mathcal{O}_{U'}$ represents the
functor $\mathcal{F} \mapsto \mathcal{F}(U')$.
Moreover below we describe a canonical map of $\mathcal{O}$-modules
$$
j'_!\mathcal{O}_{U'} \longrightarrow j_!\mathcal{O}_U
$$
which corresponds to the restriction mapping
$\mathcal{F}(U) \to \mathcal{F}(U')$ via Yoneda's lemma
(Categories, Lemma \ref{categories-lemma-yoneda}).
It suffices to prove the displayed map of modules is injective, see
Homology, Lemma \ref{homology-lemma-characterize-injectives}.

\medskip\noindent
To construct our map it suffices to construct a map between the
presheaves which assign to an object $V$ of $\mathcal{C}$ the
$\mathcal{O}(V)$-module
$$
\bigoplus\nolimits_{\varphi' \in \Mor_\mathcal{C}(V, U')} \mathcal{O}(V)
\quad\text{and}\quad
\bigoplus\nolimits_{\varphi \in \Mor_\mathcal{C}(V, U)} \mathcal{O}(V)
$$
see Modules on Sites, Lemma \ref{sites-modules-lemma-extension-by-zero}.
We take the map which maps the summand corresponding to $\varphi'$
to the summand corresponding to $\varphi = a \circ \varphi'$
by the identity map on $\mathcal{O}(V)$. As $a$ is a monomorphism,
this map is injective. As sheafification is exact, the result
follows.
\end{proof}






\section{Totally acyclic sheaves}
\label{section-limp}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $K$ be a presheaf of sets on $\mathcal{C}$ (we intentionally use a
roman capital here to distinguish from abelian sheaves).
Given a sheaf of $\mathcal{O}$-modules $\mathcal{F}$ we set
$$
\mathcal{F}(K) =
\Mor_{\textit{PSh}(\mathcal{C})}(K, \mathcal{F}) =
\Mor_{\Sh(\mathcal{C})}(K^\#, \mathcal{F})
$$
The functor $\mathcal{F} \mapsto \mathcal{F}(K)$ is a left exact functor
$\textit{Mod}(\mathcal{O}) \to \textit{Ab}$ hence we have its
right derived functors. We will denote these $H^p(K, \mathcal{F})$
so that $H^0(K, \mathcal{F}) = \mathcal{F}(K)$.

\medskip\noindent
Here are some observations:
\begin{enumerate}
\item Since $\mathcal{F}(K) = \mathcal{F}(K^\#)$, we have
$H^p(K, \mathcal{F}) = H^p(K^\#, \mathcal{F})$.
Allowing $K$ to be a presheaf in the definition above is
a purely notational convenience.
\item Suppose that $K = h_U$ or $K = h_U^\#$ for some object $U$
of $\mathcal{C}$. Then $H^p(K, \mathcal{F}) = H^p(U, \mathcal{F})$, because
$\Mor_{\Sh(\mathcal{C})}(h_U^\#, \mathcal{F}) = \mathcal{F}(U)$, see
Sites, Section \ref{sites-section-representable-sheaves}.
\item If $\mathcal{O} = \mathbf{Z}$ (the constant sheaf), then
the cohomology groups are functors
$H^p(K, - ) : \textit{Ab}(\mathcal{C}) \to \textit{Ab}$
since $\textit{Mod}(\mathcal{O}) = \textit{Ab}(\mathcal{C})$ in this case.
\end{enumerate}
We can translate some of our already proven results using this language.

\begin{lemma}
\label{lemma-compute-cohomology-on-sheaf-sets}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $K$ be a presheaf of sets on $\mathcal{C}$.
Let $\mathcal{F}$ be an $\mathcal{O}$-module and denote
$\mathcal{F}_{ab}$ the underlying sheaf of abelian groups.
Then $H^p(K, \mathcal{F}) = H^p(K, \mathcal{F}_{ab})$.
\end{lemma}

\begin{proof}
We may replace $K$ by its sheafification and assume $K$ is a sheaf.
Note that both $H^p(K, \mathcal{F})$ and $H^p(K, \mathcal{F}_{ab})$
depend only on the topos, not on the underlying site. Hence by
Sites, Lemma \ref{sites-lemma-topos-good-site}
we may replace $\mathcal{C}$ by a ``larger'' site such
that $K = h_U$ for some object $U$ of $\mathcal{C}$.
In this case the result follows from
Lemma \ref{lemma-cohomology-modules-abelian-agree}.
\end{proof}

\begin{lemma}
\label{lemma-cech-to-cohomology-sheaf-sets}
Let $\mathcal{C}$ be a site. Let $K' \to K$ be a map of presheaves
of sets on $\mathcal{C}$ whose sheafification is surjective. Set
$K'_p = K' \times_K \ldots \times_K K'$ ($p + 1$-factors).
For every abelian sheaf $\mathcal{F}$ there is a spectral sequence
with $E_1^{p, q} = H^q(K'_p, \mathcal{F})$ converging to
$H^{p + q}(K, \mathcal{F})$.
\end{lemma}

\begin{proof}
Since sheafification is exact, we see that
$(K_p')^\#$ is equal to
$(K')^\# \times_{K^\#} \ldots \times_{K^\#} (K')^\#$
($p + 1$-factors). Thus we may replace $K$ and $K'$ by
their sheafifications and assume $K \to K'$ is a surjective
map of sheaves. After replacing $\mathcal{C}$ by a ``larger'' site as in
Sites, Lemma \ref{sites-lemma-topos-good-site} 
we may assume that $K, K'$ are objects of $\mathcal{C}$ and that
$\mathcal{U} = \{K' \to K\}$ is a covering. Then we have the {\v C}ech
to cohomology spectral sequence of Lemma \ref{lemma-cech-spectral-sequence}
whose $E_1$ page is as indicated in the statement of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-on-sheaf-sets}
Let $\mathcal{C}$ be a site. Let $K$ be a sheaf of sets on $\mathcal{C}$.
Consider the morphism of topoi
$j : \Sh(\mathcal{C}/K) \to \Sh(\mathcal{C})$, see
Sites, Lemma \ref{sites-lemma-localize-topos-site}.
Then $j^{-1}$ preserves injectives and
$H^p(K, \mathcal{F}) = H^p(\mathcal{C}/K, j^{-1}\mathcal{F})$
for any abelian sheaf $\mathcal{F}$ on $\mathcal{C}$.
\end{lemma}

\begin{proof}
By
Sites, Lemmas \ref{sites-lemma-localize-topos} and
\ref{sites-lemma-localize-topos-site}
the morphism of topoi $j$ is
equivalent to a localization. Hence this follows from
Lemma \ref{lemma-cohomology-of-open}.
\end{proof}

\noindent
Keeping in mind Lemma \ref{lemma-compute-cohomology-on-sheaf-sets}
we see that the following definition is the ``correct one'' also
for sheaves of modules on ringed sites.

\begin{definition}
\label{definition-limp}
Let $\mathcal{C}$ be a site.
We say an abelian sheaf $\mathcal{F}$ is
{\it totally acyclic}\footnote{Although this terminology is is used in
\cite[Vbis, Proposition 1.3.10]{SGA4} this is probably nonstandard notation.
In \cite[V, Definition 4.1]{SGA4} this property is dubbed ``flasque'', but
we cannot use this because it would clash with our definition
of flasque sheaves on topological spaces. Please email
\href{mailto:stacks.project@gmail.com}{stacks.project@gmail.com}
if you have a better suggestion.}
if for every sheaf of sets $K$ we have $H^p(K, \mathcal{F}) = 0$
for all $p \geq 1$.
\end{definition}

\noindent
It is clear that being totally acyclic is an intrinsic property, i.e.,
preserved under equivalences of topoi.
A totally acyclic sheaf has vanishing higher cohomology on all objects
of the site, but in general the condition of being totally acyclic
is strictly stronger.
Here is a characterization of totally acyclic sheaves which is sometimes useful.

\begin{lemma}
\label{lemma-characterize-limp}
Let $\mathcal{C}$ be a site. Let $\mathcal{F}$ be an abelian sheaf. If
\begin{enumerate}
\item $H^p(U, \mathcal{F}) = 0$ for $p > 0$ and $U \in \Ob(\mathcal{C})$, and
\item for every surjection $K' \to K$ of sheaves of sets the
extended {\v C}ech complex
$$
0 \to H^0(K, \mathcal{F}) \to H^0(K', \mathcal{F}) \to
H^0(K' \times_K K', \mathcal{F}) \to \ldots
$$
is exact,
\end{enumerate}
then $\mathcal{F}$ is totally acyclic (and the converse holds too).
\end{lemma}

\begin{proof}
By assumption (1) we have $H^p(h_U^\#, g^{-1}\mathcal{I}) = 0$ for all
$p > 0$ and all objects $U$ of $\mathcal{C}$. Note that if
$K = \coprod K_i$ is a coproduct of sheaves of sets on $\mathcal{C}$
then $H^p(K, g^{-1}\mathcal{I}) = \prod H^p(K_i, g^{-1}\mathcal{I})$.
For any sheaf of sets $K$ there exists a surjection
$$
K' = \coprod h_{U_i}^\# \longrightarrow K
$$
see Sites, Lemma \ref{sites-lemma-sheaf-coequalizer-representable}.
Thus we conclude that: (*) for every sheaf of sets $K$ there exists a
surjection $K' \to K$ of sheaves of sets such that $H^p(K', \mathcal{F}) = 0$
for $p > 0$. We claim that (*) and condition (2) imply that $\mathcal{F}$
is totally acyclic.
Note that conditions (*) and (2) only depend on $\mathcal{F}$ as an
object of the topos $\Sh(\mathcal{C})$ and not on the underlying site.
(We will not use property (1) in the rest of the proof.)

\medskip\noindent
We are going to prove by induction on $n \geq 0$ that (*) and (2)
imply the following induction hypothesis $IH_n$:
$H^p(K, \mathcal{F}) = 0$ for all $0 < p \leq n$ and
all sheaves of sets $K$. Note that $IH_0$ holds. Assume $IH_n$. Pick
a sheaf of sets $K$. Pick a surjection $K' \to K$ such that
$H^p(K', \mathcal{F}) = 0$ for all $p > 0$. We have a
spectral sequence with
$$
E_1^{p, q} = H^q(K'_p, \mathcal{F})
$$
covering to $H^{p + q}(K, \mathcal{F})$, see
Lemma \ref{lemma-cech-to-cohomology-sheaf-sets}.
By $IH_n$ we see that $E_1^{p, q} = 0$ for $0 < q \leq n$ and by
assumption (2) we see that $E_2^{p, 0} = 0$ for $p > 0$. Finally, we have
$E_1^{0, q} = 0$ for $q > 0$ because $H^q(K', \mathcal{F}) = 0$ by
choice of $K'$. Hence we conclude that $H^{n + 1}(K, \mathcal{F}) = 0$
because all the terms $E_2^{p, q}$ with $p + q = n + 1$ are zero.
\end{proof}







\section{The Leray spectral sequence}
\label{section-leray}

\noindent
The key to proving the existence of the Leray spectral sequence is
the following lemma.

\begin{lemma}
\label{lemma-direct-image-injective-sheaf}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Then for any injective object $\mathcal{I}$ in
$\textit{Mod}(\mathcal{O}_\mathcal{C})$
the pushforward $f_*\mathcal{I}$ is totally acyclic.
\end{lemma}

\begin{proof}
Let $K$ be a sheaf of sets on $\mathcal{D}$.
By
Modules on Sites, Lemma
\ref{sites-modules-lemma-morphism-ringed-topoi-comes-from-morphism-ringed-sites}
we may replace $\mathcal{C}$, $\mathcal{D}$ by ``larger'' sites such
that $f$ comes from a morphism of ringed sites induced by a continuous
functor $u : \mathcal{D} \to \mathcal{C}$ such that
$K = h_V$ for some object $V$ of $\mathcal{D}$.

\medskip\noindent
Thus we have to show that $H^q(V, f_*\mathcal{I})$ is zero
for $q > 0$ and all objects $V$ of $\mathcal{D}$ when $f$ is given
by a morphism of ringed sites. Let $\mathcal{V} = \{V_j \to V\}$
be any covering of $\mathcal{D}$. Since $u$ is continuous we see that
$\mathcal{U} = \{u(V_j) \to u(V)\}$ is a covering of $\mathcal{C}$.
Then we have an equality of {\v C}ech complexes
$$
\check{\mathcal{C}}^\bullet(\mathcal{V}, f_*\mathcal{I})
=
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I})
$$
by the definition of $f_*$. By
Lemma \ref{lemma-injective-module-trivial-cech}
we see that the cohomology of this complex is zero in positive degrees.
We win by
Lemma \ref{lemma-cech-vanish-collection}.
\end{proof}

\noindent
For flat morphisms the functor $f_*$ preserves injective modules.
In particular the functor
$f_* : \textit{Ab}(\mathcal{C}) \to \textit{Ab}(\mathcal{D})$ always
 transforms injective
abelian sheaves into injective abelian sheaves.

\begin{lemma}
\label{lemma-pushforward-injective-flat}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
If $f$ is flat, then $f_*\mathcal{I}$ is an injective
$\mathcal{O}_\mathcal{D}$-module
for any injective $\mathcal{O}_\mathcal{C}$-module $\mathcal{I}$.
\end{lemma}

\begin{proof}
In this case the functor $f^*$ is exact, see
Modules on Sites, Lemma \ref{sites-modules-lemma-flat-pullback-exact}.
Hence the result follows from
Homology, Lemma \ref{homology-lemma-adjoint-preserve-injectives}.
\end{proof}

\begin{lemma}
\label{lemma-limp-acyclic}
Let $(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})$ be a ringed topos.
A totally acyclic sheaf is right acyclic for the following functors:
\begin{enumerate}
\item the functor $H^0(U, -)$ for any object $U$ of $\mathcal{C}$,
\item the functor $\mathcal{F} \mapsto \mathcal{F}(K)$ for any
presheaf of sets $K$,
\item the functor $\Gamma(\mathcal{C}, -)$ of global sections,
\item the functor $f_*$ for any morphism
$f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ of ringed topoi.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (2) is the definition of a totally acyclic sheaf.
Part (1) is a consequence of (2) as pointed out in the discussion following the
definition of totally acyclic sheaves.
Part (3) is a special case of (2) where $K = e$ is the final object
of $\Sh(\mathcal{C})$.

\medskip\noindent
To prove (4) we may assume, by
Modules on Sites, Lemma
\ref{sites-modules-lemma-morphism-ringed-topoi-comes-from-morphism-ringed-sites}
that $f$ is given by a morphism of sites. In this case we see that
$R^if_*$, $i > 0$ of a totally acyclic sheaf are zero by the description of
higher direct images in
Lemma \ref{lemma-higher-direct-images}.
\end{proof}

\begin{remark}
\label{remark-before-Leray}
As a consequence of the results above we find that
Derived Categories, Lemma \ref{derived-lemma-compose-derived-functors}
applies to a number of situations. For example, given a
morphism $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ of ringed topoi we have
$$
R\Gamma(\mathcal{D}, Rf_*\mathcal{F}) = R\Gamma(\mathcal{C}, \mathcal{F})
$$
for any sheaf of $\mathcal{O}_\mathcal{C}$-modules $\mathcal{F}$.
Namely, for an injective $\mathcal{O}_\mathcal{X}$-module $\mathcal{I}$
the $\mathcal{O}_\mathcal{D}$-module $f_*\mathcal{I}$ is totally acyclic by
Lemma \ref{lemma-direct-image-injective-sheaf}
and a totally acyclic sheaf is acyclic for $\Gamma(\mathcal{D}, -)$ by
Lemma \ref{lemma-limp-acyclic}.
\end{remark}

\begin{lemma}[Leray spectral sequence]
\label{lemma-Leray}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $\mathcal{F}^\bullet$ be a bounded below complex of
$\mathcal{O}_\mathcal{C}$-modules. There is a spectral sequence
$$
E_2^{p, q} = H^p(\mathcal{D}, R^qf_*(\mathcal{F}^\bullet))
$$
converging to $H^{p + q}(\mathcal{C}, \mathcal{F}^\bullet)$.
\end{lemma}

\begin{proof}
This is just the Grothendieck spectral sequence
Derived Categories, Lemma \ref{derived-lemma-grothendieck-spectral-sequence}
coming from the composition of functors
$\Gamma(\mathcal{C}, -) = \Gamma(\mathcal{D}, -) \circ f_*$.
To see that the assumptions of
Derived Categories, Lemma \ref{derived-lemma-grothendieck-spectral-sequence}
are satisfied, see
Lemmas \ref{lemma-direct-image-injective-sheaf} and
\ref{lemma-limp-acyclic}.
\end{proof}

\begin{lemma}
\label{lemma-apply-Leray}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $\mathcal{F}$ be an $\mathcal{O}_\mathcal{C}$-module.
\begin{enumerate}
\item If $R^qf_*\mathcal{F} = 0$ for $q > 0$, then
$H^p(\mathcal{C}, \mathcal{F}) = H^p(\mathcal{D}, f_*\mathcal{F})$ for all $p$.
\item If $H^p(\mathcal{D}, R^qf_*\mathcal{F}) = 0$ for all $q$ and $p > 0$,
then $H^q(\mathcal{C}, \mathcal{F}) = H^0(\mathcal{D}, R^qf_*\mathcal{F})$
for all $q$.
\end{enumerate}
\end{lemma}

\begin{proof}
These are two simple conditions that force the Leray spectral sequence to
converge. You can also prove these facts directly (without using the
spectral sequence) which is a good exercise in cohomology of sheaves.
\end{proof}

\begin{lemma}[Relative Leray spectral sequence]
\label{lemma-relative-Leray}
Let
$f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
and
$g : (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D}) \to
(\Sh(\mathcal{E}), \mathcal{O}_\mathcal{E})$
be morphisms of ringed topoi.
Let $\mathcal{F}$ be an $\mathcal{O}_\mathcal{C}$-module.
There is a spectral sequence with
$$
E_2^{p, q} = R^pg_*(R^qf_*\mathcal{F})
$$
converging to $R^{p + q}(g \circ f)_*\mathcal{F}$.
This spectral sequence is functorial in $\mathcal{F}$, and there
is a version for bounded below complexes of $\mathcal{O}_\mathcal{C}$-modules.
\end{lemma}

\begin{proof}
This is a Grothendieck spectral sequence for composition of functors, see
Derived Categories, Lemma \ref{derived-lemma-grothendieck-spectral-sequence}
and
Lemmas \ref{lemma-direct-image-injective-sheaf} and
\ref{lemma-limp-acyclic}.
\end{proof}







\section{The base change map}
\label{section-base-change-map}

\noindent
In this section we construct the base change map in some cases;
the general case is treated in Remark \ref{remark-base-change}.
The discussion in this section avoids using
derived pullback by restricting to the case of a base change
by a flat morphism of ringed sites.
Before we state the result, let us discuss flat pullback on the derived
category. Suppose
$g : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
is a flat morphism of ringed topoi. By
Modules on Sites, Lemma \ref{sites-modules-lemma-flat-pullback-exact}
the functor $g^* : \textit{Mod}(\mathcal{O}_\mathcal{D}) \to
\textit{Mod}(\mathcal{O}_\mathcal{C})$ is exact.
Hence it has a derived functor
$$
g^* : D(\mathcal{O}_\mathcal{D}) \to D(\mathcal{O}_\mathcal{C})
$$
which is computed by simply pulling back an representative of a given
object in $D(\mathcal{O}_\mathcal{D})$, see
Derived Categories, Lemma \ref{derived-lemma-right-derived-exact-functor}.
It preserved the bounded (above, below) subcategories.
Hence as indicated we indicate this functor by $g^*$ rather than $Lg^*$.

\begin{lemma}
\label{lemma-base-change-map-flat-case}
Let
$$
\xymatrix{
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'})
\ar[r]_{g'} \ar[d]_{f'} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^f \\
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'})
\ar[r]^g &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
be a commutative diagram of ringed topoi.
Let $\mathcal{F}^\bullet$ be a bounded below complex of
$\mathcal{O}_\mathcal{C}$-modules.
Assume both $g$ and $g'$ are flat.
Then there exists a canonical base change map
$$
g^*Rf_*\mathcal{F}^\bullet
\longrightarrow
R(f')_*(g')^*\mathcal{F}^\bullet
$$
in $D^{+}(\mathcal{O}_{\mathcal{D}'})$.
\end{lemma}

\begin{proof}
Choose injective resolutions $\mathcal{F}^\bullet \to \mathcal{I}^\bullet$
and $(g')^*\mathcal{F}^\bullet \to \mathcal{J}^\bullet$.
By Lemma \ref{lemma-pushforward-injective-flat} we see that
$(g')_*\mathcal{J}^\bullet$ is a complex of injectives representing
$R(g')_*(g')^*\mathcal{F}^\bullet$. Hence by
Derived Categories, Lemmas \ref{derived-lemma-morphisms-lift}
and \ref{derived-lemma-morphisms-equal-up-to-homotopy}
the arrow $\beta$ in the diagram
$$
\xymatrix{
(g')_*(g')^*\mathcal{F}^\bullet \ar[r] &
(g')_*\mathcal{J}^\bullet \\
\mathcal{F}^\bullet \ar[u]^{adjunction} \ar[r] &
\mathcal{I}^\bullet \ar[u]_\beta
}
$$
exists and is unique up to homotopy.
Pushing down to $\mathcal{D}$ we get
$$
f_*\beta :
f_*\mathcal{I}^\bullet
\longrightarrow
f_*(g')_*\mathcal{J}^\bullet
=
g_*(f')_*\mathcal{J}^\bullet
$$
By adjunction of $g^*$ and $g_*$ we get a map of complexes
$g^*f_*\mathcal{I}^\bullet \to (f')_*\mathcal{J}^\bullet$.
Note that this map is unique up to homotopy since the only
choice in the whole process was the choice of the map $\beta$
and everything was done on the level of complexes.
\end{proof}








\section{Cohomology and colimits}
\label{section-limits}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{I} \to \textit{Mod}(\mathcal{O})$, $i \mapsto \mathcal{F}_i$
be a diagram over the index category $\mathcal{I}$, see
Categories, Section \ref{categories-section-limits}.
For each $i$ there is a canonical map
$\mathcal{F}_i \to \colim_i \mathcal{F}_i$ which induces
a map on cohomology. Hence we get a canonical map
$$
\colim_i H^p(U, \mathcal{F}_i)
\longrightarrow
H^p(U, \colim_i \mathcal{F}_i)
$$
for every $p \geq 0$ and every object $U$ of $\mathcal{C}$.
These maps are in general not isomorphisms, even for $p = 0$.

\medskip\noindent
The following lemma is the analogue of
Sites, Lemma \ref{sites-lemma-directed-colimits-sections}
for cohomology.

\begin{lemma}
\label{lemma-colim-works-over-collection}
Let $\mathcal{C}$ be a site. Let $\text{Cov}_\mathcal{C}$ be the set
of coverings of $\mathcal{C}$ (see
Sites, Definition \ref{sites-definition-site}). Let
$\mathcal{B} \subset \Ob(\mathcal{C})$, and
$\text{Cov} \subset \text{Cov}_\mathcal{C}$
be subsets. Assume that
\begin{enumerate}
\item For every $\mathcal{U} \in \text{Cov}$ we have
$\mathcal{U} = \{U_i \to U\}_{i \in I}$ with $I$ finite,
$U, U_i \in \mathcal{B}$ and every
$U_{i_0} \times_U \ldots \times_U U_{i_p} \in \mathcal{B}$.
\item For every $U \in \mathcal{B}$ the coverings of $U$
occurring in $\text{Cov}$ is a cofinal system of coverings of $U$.
\end{enumerate}
Then the map
$$
\colim_i H^p(U, \mathcal{F}_i)
\longrightarrow
H^p(U, \colim_i \mathcal{F}_i)
$$
is an isomorphism for every $p \geq 0$, every $U \in \mathcal{B}$, and
every filtered diagram $\mathcal{I} \to \textit{Ab}(\mathcal{C})$.
\end{lemma}

\begin{proof}
To prove the lemma we will argue by induction on $p$.
Note that we require in (1) the coverings $\mathcal{U} \in \text{Cov}$
to be finite, so that all the elements of $\mathcal{B}$ are quasi-compact.
Hence (2) and (1) imply that any $U \in \mathcal{B}$ satisfies the hypothesis
of Sites, Lemma \ref{sites-lemma-directed-colimits-sections} (4).
Thus we see that the result holds for $p = 0$.
Now we assume the lemma holds for $p$ and prove it for $p + 1$.

\medskip\noindent
Choose a filtered diagram
$\mathcal{F} : \mathcal{I} \to \textit{Ab}(\mathcal{C})$,
$i \mapsto \mathcal{F}_i$.
Since $\textit{Ab}(\mathcal{C})$ has functorial injective embeddings, see
Injectives, Theorem \ref{injectives-theorem-sheaves-injectives},
we can find a morphism of filtered diagrams
$\mathcal{F} \to \mathcal{I}$
such that each $\mathcal{F}_i \to \mathcal{I}_i$ is an injective map of
abelian sheaves into an injective abelian sheaf. Denote $\mathcal{Q}_i$
the cokernel so that we have short exact sequences
$$
0 \to
\mathcal{F}_i \to
\mathcal{I}_i \to
\mathcal{Q}_i \to 0.
$$
Since colimits of sheaves are the sheafification of colimits on the level
of presheaves, since sheafification is exact, and since filtered
colimits of abelian groups are exact
(see Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact}),
we see the sequence
$$
0 \to
\colim_i \mathcal{F}_i \to
\colim_i \mathcal{I}_i \to
\colim_i \mathcal{Q}_i \to 0.
$$
is also a short exact sequence. We claim that
$H^q(U, \colim_i \mathcal{I}_i) = 0$ for all $U \in \mathcal{B}$
and all $q \geq 1$. Accepting this claim
for the moment consider the diagram
$$
\xymatrix{
\colim_i H^p(U, \mathcal{I}_i) \ar[d] \ar[r] &
\colim_i H^p(U, \mathcal{Q}_i) \ar[d] \ar[r] &
\colim_i H^{p + 1}(U, \mathcal{F}_i) \ar[d] \ar[r] &
0 \ar[d] \\
H^p(U, \colim_i \mathcal{I}_i) \ar[r] &
H^p(U, \colim_i \mathcal{Q}_i) \ar[r] &
H^{p + 1}(U, \colim_i \mathcal{F}_i) \ar[r] &
0
}
$$
The zero at the lower right corner comes from the claim and the
zero at the upper right corner comes from the fact that the sheaves
$\mathcal{I}_i$ are injective.
The top row is exact by an application of
Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact}.
Hence by the snake lemma we deduce the
result for $p + 1$.

\medskip\noindent
It remains to show that the claim is true. We will use
Lemma \ref{lemma-cech-vanish-collection}.
By the result for $p = 0$ we see that for $\mathcal{U} \in \text{Cov}$
we have
$$
\check{\mathcal{C}}^\bullet(\mathcal{U}, \colim_i \mathcal{I}_i)
=
\colim_i \check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{I}_i)
$$
because all the $U_{j_0} \times_U \ldots \times_U U_{j_p}$
are in $\mathcal{B}$. By
Lemma \ref{lemma-injective-trivial-cech}
each of the complexes in the colimit of {\v C}ech complexes is
acyclic in degree $\geq 1$. Hence by
Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact}
we see that also the {\v C}ech complex
$\check{\mathcal{C}}^\bullet(\mathcal{U}, \colim_i \mathcal{I}_i)$
is acyclic in degrees $\geq 1$. In other words we see that
$\check{H}^p(\mathcal{U}, \colim_i \mathcal{I}_i) = 0$
for all $p \geq 1$. Thus the assumptions of
Lemma \ref{lemma-cech-vanish-collection}.
are satisfied and the claim follows.
\end{proof}

\begin{lemma}
\label{lemma-colim-global}
Let $\mathcal{C}$ be a site. Let $S \subset \Ob(\Sh(\mathcal{C}))$
be a subset. Denote $*$ the final object of $\Sh(\mathcal{C})$. Assume
\begin{enumerate}
\item for some $K \in S$ the map $K \to *$ is surjective,
\item given a surjective map of sheaves $\mathcal{F} \to K$ with $K \in S$
there exists a $K' \in S$ and a map $K' \to \mathcal{F}$ such
that the composition $K' \to K$ is surjective,
\item given $K, K' \in S$ there is a surjection $K'' \to K \times K'$
with $K'' \in S$,
\item given $a, b : K \to K'$ with $K, K' \in S$ there exists a
surjection $K'' \to \text{Equalizer}(a, b)$ with $K'' \in S$, and
\item every $K \in S$ is quasi-compact
(Sites, Definition \ref{sites-definition-quasi-compact-topos}).
\end{enumerate}
Then for all $p \geq 0$ the map
$$
\colim_\lambda H^p(\mathcal{C}, \mathcal{F}_\lambda)
\longrightarrow
H^p(\mathcal{C}, \colim_\lambda \mathcal{F}_\lambda)
$$
is an isomorphism for every filtered diagram
$\Lambda \to \textit{Ab}(\mathcal{C})$, $\lambda \mapsto \mathcal{F}_\lambda$.
\end{lemma}

\begin{proof}
We will prove this by induction on $p$. The base case $p = 0$
follows from
Sites, Lemma \ref{sites-lemma-directed-colimits-global-sections} part (4).
We check the assumptions hold, but we urge the reader to skip this part.
Suppose $\mathcal{F} \to *$ is surjective.
Choose $K \in S$ and $K \to *$ surjective as in (1). Then
$\mathcal{F} \times K \to K$ is surjective. Choose
$K' \to \mathcal{F} \times K$ with $K' \in S$ and $K' \to K$
surjective as in (2).
Then there is a map $K' \to \mathcal{F}$ and $K' \to *$ is surjective.
Hence 
Sites, Lemma \ref{sites-lemma-directed-colimits-global-sections}
assumption (4)(a) is satisfied.
By Sites, Lemma \ref{sites-lemma-image-of-quasi-compact}, assumptions
(3) and (5) we see that $K \times K$ is quasi-compact
for all $K \in S$.
Hence 
Sites, Lemma \ref{sites-lemma-directed-colimits-global-sections}
assumption (4)(b) is satisfied.
This finishes the proof of the base case.

\medskip\noindent
Induction step. Assume the result holds for
$H^p$ for $p \leq p_0$ and for all topoi $\Sh(\mathcal{C})$
such that a set $S \subset \Ob(\Sh(\mathcal{C}))$ can be found
satisfying (1) -- (5). Arguing exactly as in the proof of
Lemma \ref{lemma-colim-works-over-collection}
we see that it suffices to show: given a filtered colimit
$\mathcal{I} = \colim \mathcal{I}_\lambda$ with
$\mathcal{I}_\lambda$ injective abelian sheaves, we have
$H^{p_0 + 1}(\mathcal{C}, \mathcal{I}) = 0$.
Choose $K \to *$ surjective with $K \in S$ as in (1).
Denote $K^n$ the $n$-fold self product of $K$.
Consider the spectral sequence
$$
E_1^{p, q} = H^q(K^{p + 1}, \mathcal{I}) \Rightarrow
H^{p + q}(*, \mathcal{I}) = H^{p + q}(\mathcal{C}, \mathcal{I})
$$
of Lemma \ref{lemma-cech-to-cohomology-sheaf-sets}. Recall that
$H^q(K^{p + 1}, \mathcal{F}) = H^q(\mathcal{C}/K^{p + 1}, j^{-1}\mathcal{F})$,
for any abelian sheaf on $\mathcal{C}$, see
Lemma \ref{lemma-cohomology-on-sheaf-sets}. We have
$j^{-1}\mathcal{I} = \colim j^{-1}\mathcal{I}_\lambda$
as $j^{-1}$ commutes with colimits. The restrictions
$j^{-1}\mathcal{I}_\lambda$ are injective abelian sheaves
on $\mathcal{C}/K^{p + 1}$ by Lemma \ref{lemma-cohomology-of-open}.
Below we will show that the induction hypothesis applies
to $\mathcal{C}/K^{p + 1}$ and hence we see that
$H^q(K^{p + 1}, \mathcal{I}) = \colim H^q(K^{p + 1}, \mathcal{I}_\lambda) = 0$
for $q < p_0 + 1$ (vanishing as $\mathcal{I}_\lambda$ is injective).
It follows that
$$
H^{p_0 + 1}(\mathcal{C}, \mathcal{I}) =
H^{p_0 + 1}\left(\ldots \to
H^0(K^{p_0}, \mathcal{I}) \to
H^0(K^{p_0 + 1}, \mathcal{I}) \to
H^0(K^{p_0 + 2}, \mathcal{I}) \to \ldots\right)
$$
Again using the induction hypothesis, the complex depicted on the right
hand side is the colimit over $\Lambda$ of the complexes
$$
\ldots \to
H^0(K^{p_0}, \mathcal{I}_\lambda) \to
H^0(K^{p_0 + 1}, \mathcal{I}_\lambda) \to
H^0(K^{p_0 + 2}, \mathcal{I}_\lambda) \to \ldots
$$
These complexes are exact as $\mathcal{I}_\lambda$ is an
injective abelian sheaf (follows from the spectral sequence
for example). Since filtered colimits are exact in the category
of abelian groups we obtain the desired vanishing.

\medskip\noindent
We still have to show that the induction hypothesis applies
to the site $\mathcal{C}/K^n$ for all $n \geq 1$. Recall
that $\Sh(\mathcal{C}/K^n) = \Sh(\mathcal{C})/K^n$, see
Sites, Lemma \ref{sites-lemma-localize-topos-site}.
Thus we may work in $\Sh(\mathcal{C})/K^n$.
Denote $S_n \subset \Ob(\Sh(\mathcal{C}/K^n)$ the set
of objects of the form $K' \to K^n$. We check each property in turn:
\begin{enumerate}
\item By (3) and induction there exists a surjection
$K' \to K^n$ with $K' \in S$. Then $(K' \to K^n) \to (K^n \to K^n)$
is a surjection in $\Sh(\mathcal{C})/K^n$ and $K^n \to K^n$
is the final object of $\Sh(\mathcal{C})/K^n$. Hence (1) holds for $S_n$,
\item Property (2) for $S_n$ is an immediate consquence
of (2) for $S$.
\item Let $a : K_1 \to K^n$ and $b : K_2 \to K^n$ be in $S_n$.
Then $(K_1 \to K^n) \times (K_2 \to K^n)$ is the object
$K_1 \times_{K^n} K_2 \to K^n$ of $\Sh(\mathcal{C})/K^n$.
The subsheaf $K_1 \times_{K^n} K_2 \subset K_1 \times K_2$ is the
equalizer of $a \circ \text{pr}_1$ and $b \circ \text{pr}_2$.
Write $a = (a_1, \ldots, a_n)$ and $b = (b_1, \ldots, b_n)$.
Pick $K_3 \to K_1 \times K_2$ surjective with $K_3 \in S$;
this is possibly by assumption (3) for $\mathcal{C}$.
Pick
$$
K_4
\longrightarrow
\text{Equalizer}(K_3 \to K_1 \times K_2 \xrightarrow{a_1, b_1} K)
$$
surjective with $K_4 \in S$.
This is possible by assumption (4) for $\mathcal{C}$.
Pick
$$
K_5
\longrightarrow
\text{Equalizer}(K_4 \to K_1 \times K_2 \xrightarrow{a_2, b_2} K)
$$
surjective with $K_5 \in S$.
Again this is possible. Continue in this fashion until we get
$$
K_{3 + n}
\longrightarrow
\text{Equalizer}(K_{2 + n} \to K_1 \times K_2 \xrightarrow{a_n, b_n} K)
$$
surjective with $K_{3 + n} \in S$. By construction
$K_{3 + n} \to K_1 \times_{K^n} K_2$
is surjective. Hence $(K_{3 + n} \to K^n)$ is in $S_n$ and
surjects onto the product $(K_1 \to K^n) \times (K_2 \to K^n)$.
Thus (3) holds for $S_n$.
\item Property (4) for $S_n$ is an immediate consequence of
property (4) for $S$.
\item Property (5) for $S_n$ is a consequence of
property (5) for $S$. Namely, an object $\mathcal{F} \to K^n$ of
$\Sh(\mathcal{C})/K^n$ corresponds to a quasi-compact object of
$\Sh(\mathcal{C}/K^n)$ if and only if $\mathcal{F}$ is a
quasi-compact object of $\Sh(\mathcal{C})$.
\end{enumerate}
This finishes the proof of the lemma.
\end{proof}

\begin{remark}
\label{remark-colim-global}
Let $\mathcal{C}$ be a site. Let $\mathcal{B} \subset \Ob(\mathcal{C})$
be a subset. Let $S \subset \Ob(\Sh(\mathcal{C}))$
be the set of sheaves $K$ which have the form
$$
K = \coprod\nolimits_{i = 1, \ldots, n} h_{U_i}^\#
$$
with $U_1, \ldots, U_n \in \mathcal{B}$. Then we can
ask: when does this set satisfy the assumptions of
Lemma \ref{lemma-colim-global}? One answer is that it suffices if
\begin{enumerate}
\item for some $n \geq 0$, $U_1, \ldots, U_n \in \mathcal{B}$
the map $\coprod_{i = 1, \ldots, n} h_{U_i}^\# \to *$ is surjective,
\item every covering of $U \in \mathcal{B}$ can be refined
by a covering of the form $\{U_i \to U\}_{i = 1, \ldots, n}$
with $U_i \in \mathcal{B}$,
\item given $U, U' \in \mathcal{B}$ there exist $n \geq 0$,
$U_1, \ldots, U_n \in \mathcal{B}$, maps $U_i \to U$ and
$U_i \to U'$ such that $\coprod_{i = 1, \ldots, n} h_{U_i}^\# \to
h_U^\# \times h_{U'}^\#$ is surjective,
\item given morphisms $a, b : U \to U'$ in $\mathcal{C}$ with
$U, U' \in \mathcal{B}$, there exist $U_1, \ldots, U_n \in \mathcal{B}$,
maps $U_i \to U$ equalizing $a, b$ such that
$\coprod_{i = 1, \ldots, n} h_{U_i}^\# \to
\text{Equalizer}(h_a^\#, h_b^\# : h_U^\# \to h_{U'}^\#)$
is surjective.
\end{enumerate}
We omit the detailed verification, except to mention that part (2)
above insures that every element of $\mathcal{B}$ is quasi-compact
and hence every $K \in S$ is quasi-compact as well by
Sites, Lemma \ref{sites-lemma-coproduct-quasi-compact}.
\end{remark}

\begin{lemma}
\label{lemma-colim-sites-injective}
Let $\mathcal{I}$ be a cofiltered index category and let
$(\mathcal{C}_i, f_a)$ be an inverse system of sites over $\mathcal{I}$
as in Sites, Situation \ref{sites-situation-inverse-limit-sites}.
Set $\mathcal{C} = \colim \mathcal{C}_i$ as in Sites,
Lemmas \ref{sites-lemma-colimit-sites} and
\ref{sites-lemma-compute-pullback-to-limit}.
Moreover, assume given
\begin{enumerate}
\item an abelian sheaf $\mathcal{F}_i$ on $\mathcal{C}_i$ for all
$i \in \Ob(\mathcal{I})$,
\item for $a : j \to i$ a map
$\varphi_a : f_a^{-1}\mathcal{F}_i \to \mathcal{F}_j$
of abelian sheaves on $\mathcal{C}_j$
\end{enumerate}
such that $\varphi_c = \varphi_b \circ f_b^{-1}\varphi_a$
whenever $c = a \circ b$. Then there exists a map of systems
$(\mathcal{F}_i, \varphi_a) \to (\mathcal{G}_i, \psi_a)$
such that $\mathcal{F}_i \to \mathcal{G}_i$ is injective and
$\mathcal{G}_i$ is an injective abelian sheaf.
\end{lemma}

\begin{proof}
For each $i$ we pick an injection $\mathcal{F}_i \to \mathcal{A}_i$
where $\mathcal{A}_i$ is an injective abelian sheaf on $\mathcal{C}_i$.
Then we can consider the family of maps
$$
\gamma_i :
\mathcal{F}_i
\longrightarrow
\prod\nolimits_{b : k \to i} f_{b, *}\mathcal{A}_k = \mathcal{G}_i
$$
where the component maps are the maps adjoint to the maps
$f_b^{-1}\mathcal{F}_i \to \mathcal{F}_k \to \mathcal{A}_k$.
For $a : j \to i$ in $\mathcal{I}$ there is a canonical map
$$
\psi_a : f_a^{-1}\mathcal{G}_i \to \mathcal{G}_j
$$
whose components are the canonical maps
$f_b^{-1}f_{a \circ b, *}\mathcal{A}_k \to f_{b, *}\mathcal{A}_k$
for $b : k \to j$. Thus we find an injection
$(\gamma_i) : (\mathcal{F}_i, \varphi_a) \to (\mathcal{G}_i, \psi_a)$
of systems of abelian sheaves. Note that $\mathcal{G}_i$ is an injective
sheaf of abelian groups on $\mathcal{C}_i$, see
Lemma \ref{lemma-pushforward-injective-flat} and
Homology, Lemma \ref{homology-lemma-product-injectives}.
This finishes the construction.
\end{proof}

\begin{lemma}
\label{lemma-colimit}
In the situation of Lemma \ref{lemma-colim-sites-injective} set
$\mathcal{F} = \colim f_i^{-1}\mathcal{F}_i$.
Let $i \in \Ob(\mathcal{I})$, $X_i \in \text{Ob}(\mathcal{C}_i)$. Then
$$
\colim_{a : j \to i} H^p(u_a(X_i), \mathcal{F}_j) =
H^p(u_i(X_i), \mathcal{F})
$$
for all $p \geq 0$.
\end{lemma}

\begin{proof}
The case $p = 0$ is Sites, Lemma \ref{sites-lemma-colimit}.

\medskip\noindent
Choose $(\mathcal{F}_i, \varphi_a) \to (\mathcal{G}_i, \psi_a)$
as in Lemma \ref{lemma-colim-sites-injective}.
Arguing exactly as in the proof of
Lemma \ref{lemma-colim-works-over-collection}
we see that it suffices to prove that
$H^p(X, \colim f_i^{-1}\mathcal{G}_i) = 0$ for $p > 0$.

\medskip\noindent
Set $\mathcal{G} = \colim f_i^{-1}\mathcal{G}_i$.
To show vanishing of cohomology of $\mathcal{G}$ on every object
of $\mathcal{C}$ we show that the {\v C}ech cohomology of $\mathcal{G}$
for any covering $\mathcal{U}$ of $\mathcal{C}$ is zero
(Lemma \ref{lemma-cech-vanish-collection}).
The covering $\mathcal{U}$ comes from a covering
$\mathcal{U}_i$ of $\mathcal{C}_i$ for some $i$. We have
$$
\check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{G}) =
\colim_{a : j \to i}
\check{\mathcal{C}}^\bullet(u_a(\mathcal{U}_i), \mathcal{G}_j)
$$
by the case $p = 0$. The right hand side is acyclic in positive degrees
as a filtered colimit of acyclic complexes by
Lemma \ref{lemma-injective-trivial-cech}. See
Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact}.
\end{proof}















\section{Flat resolutions}
\label{section-flat}

\noindent
In this section we redo the arguments of
Cohomology, Section \ref{cohomology-section-flat}
in the setting of ringed sites and ringed topoi.

\begin{lemma}
\label{lemma-derived-tor-exact}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{G}^\bullet$ be a complex of $\mathcal{O}$-modules.
The functors
$$
K(\textit{Mod}(\mathcal{O}))
\longrightarrow
K(\textit{Mod}(\mathcal{O})),
\quad
\mathcal{F}^\bullet \longmapsto
\text{Tot}(\mathcal{G}^\bullet \otimes_\mathcal{O} \mathcal{F}^\bullet)
$$
and
$$
K(\textit{Mod}(\mathcal{O}))
\longrightarrow
K(\textit{Mod}(\mathcal{O})),
\quad
\mathcal{F}^\bullet \longmapsto
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{G}^\bullet)
$$
are exact functors of triangulated categories.
\end{lemma}

\begin{proof}
This follows from Derived Categories, Remark
\ref{derived-remark-double-complex-as-tensor-product-of}.
\end{proof}

\begin{definition}
\label{definition-K-flat}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
A complex $\mathcal{K}^\bullet$ of $\mathcal{O}$-modules is
called {\it K-flat} if for every acyclic complex $\mathcal{F}^\bullet$
of $\mathcal{O}$-modules the complex
$$
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{K}^\bullet)
$$
is acyclic.
\end{definition}

\begin{lemma}
\label{lemma-K-flat-quasi-isomorphism}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{K}^\bullet$ be a K-flat complex.
Then the functor
$$
K(\textit{Mod}(\mathcal{O}))
\longrightarrow
K(\textit{Mod}(\mathcal{O})), \quad
\mathcal{F}^\bullet
\longmapsto
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{K}^\bullet)
$$
transforms quasi-isomorphisms into quasi-isomorphisms.
\end{lemma}

\begin{proof}
Follows from
Lemma \ref{lemma-derived-tor-exact}
and the fact that quasi-isomorphisms are characterized by having
acyclic cones.
\end{proof}

\begin{lemma}
\label{lemma-restriction-K-flat}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $U$ be an object of $\mathcal{C}$.
If $\mathcal{K}^\bullet$ is a K-flat complex of $\mathcal{O}$-modules, then
$\mathcal{K}^\bullet|_U$ is a K-flat complex of $\mathcal{O}_U$-modules.
\end{lemma}

\begin{proof}
Let $\mathcal{G}^\bullet$ be an exact complex of $\mathcal{O}_U$-modules.
Since $j_{U!}$ is exact
(Modules on Sites, Lemma \ref{sites-modules-lemma-extension-by-zero-exact})
and $\mathcal{K}^\bullet$ is a K-flat complex of $\mathcal{O}$-modules
we see that the complex
$$
j_{U!}(\text{Tot}(\mathcal{G}^\bullet \otimes_{\mathcal{O}_U}
\mathcal{K}^\bullet|_U)) =
\text{Tot}(j_{U!}\mathcal{G}^\bullet \otimes_\mathcal{O} \mathcal{K}^\bullet)
$$
is exact. Here the equality comes from
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-and-tensor}
and the fact that $j_{U!}$ commutes with direct sums (as a left adjoint).
We conclude because $j_{U!}$ reflects exactness by
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-reflects-exactness}.
\end{proof}

\begin{lemma}
\label{lemma-tensor-product-K-flat}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
If $\mathcal{K}^\bullet$, $\mathcal{L}^\bullet$ are K-flat complexes
of $\mathcal{O}$-modules, then
$\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet)$
is a K-flat complex of $\mathcal{O}$-modules.
\end{lemma}

\begin{proof}
Follows from the isomorphism
$$
\text{Tot}(\mathcal{M}^\bullet \otimes_\mathcal{O}
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet))
=
\text{Tot}(\text{Tot}(\mathcal{M}^\bullet \otimes_\mathcal{O}
\mathcal{K}^\bullet) \otimes_\mathcal{O} \mathcal{L}^\bullet)
$$
and the definition.
\end{proof}

\begin{lemma}
\label{lemma-K-flat-two-out-of-three}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{K}_1^\bullet, \mathcal{K}_2^\bullet, \mathcal{K}_3^\bullet)$
be a distinguished triangle in $K(\textit{Mod}(\mathcal{O}))$.
If two out of three of $\mathcal{K}_i^\bullet$ are K-flat, so is the third.
\end{lemma}

\begin{proof}
Follows from
Lemma \ref{lemma-derived-tor-exact}
and the fact that in a distinguished triangle in
$K(\textit{Mod}(\mathcal{O}))$
if two out of three are acyclic, so is the third.
\end{proof}

\begin{lemma}
\label{lemma-K-flat-two-out-of-three-ses}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$0 \to \mathcal{K}_1^\bullet \to \mathcal{K}_2^\bullet \to
\mathcal{K}_3^\bullet \to 0$ be a short exact sequence of complexes
such that the terms of $\mathcal{K}_3^\bullet$ are flat $\mathcal{O}$-modules.
If two out of three of $\mathcal{K}_i^\bullet$ are K-flat, so is the third.
\end{lemma}

\begin{proof}
By Modules on Sites, Lemma \ref{sites-modules-lemma-flat-tor-zero}
for every complex $\mathcal{L}^\bullet$
we obtain a short exact sequence
$$
0 \to
\text{Tot}(\mathcal{L}^\bullet \otimes_\mathcal{O} \mathcal{K}_1^\bullet) \to
\text{Tot}(\mathcal{L}^\bullet \otimes_\mathcal{O} \mathcal{K}_1^\bullet) \to
\text{Tot}(\mathcal{L}^\bullet \otimes_\mathcal{O} \mathcal{K}_1^\bullet) \to 0
$$
of complexes. Hence the lemma follows from the long exact sequence of
cohomology sheaves and the definition of K-flat complexes.
\end{proof}

\begin{lemma}
\label{lemma-bounded-flat-K-flat}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. A bounded above complex
of flat $\mathcal{O}$-modules is K-flat.
\end{lemma}

\begin{proof}
Let $\mathcal{K}^\bullet$ be a bounded above complex of flat
$\mathcal{O}$-modules. Let $\mathcal{L}^\bullet$ be an acyclic complex
of $\mathcal{O}$-modules. Note that
$\mathcal{L}^\bullet = \colim_m \tau_{\leq m}\mathcal{L}^\bullet$
where we take termwise colimits. Hence also
$$
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet)
=
\colim_m \text{Tot}(
\mathcal{K}^\bullet \otimes_\mathcal{O} \tau_{\leq m}\mathcal{L}^\bullet)
$$
termwise. Hence to prove the complex on the left is acyclic it suffices
to show each of the complexes on the right is acyclic. Since
$\tau_{\leq m}\mathcal{L}^\bullet$ is acyclic this reduces us to the
case where $\mathcal{L}^\bullet$ is bounded above.
In this case the spectral sequence of
Homology, Lemma \ref{homology-lemma-first-quadrant-ss}
has
$$
{}'E_1^{p, q} = H^p(\mathcal{L}^\bullet \otimes_R \mathcal{K}^q)
$$
which is zero as $\mathcal{K}^q$ is flat and $\mathcal{L}^\bullet$ acyclic.
Hence we win.
\end{proof}

\begin{lemma}
\label{lemma-colimit-K-flat}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{K}_1^\bullet \to \mathcal{K}_2^\bullet \to \ldots$
be a system of K-flat complexes.
Then $\colim_i \mathcal{K}_i^\bullet$ is K-flat.
\end{lemma}

\begin{proof}
Because we are taking termwise colimits it is clear that
$$
\colim_i \text{Tot}(
\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{K}_i^\bullet)
=
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O}
\colim_i \mathcal{K}_i^\bullet)
$$
Hence the lemma follows from the fact that filtered colimits are
exact.
\end{proof}

\begin{lemma}
\label{lemma-resolution-by-direct-sums-extensions-by-zero}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
For any complex $\mathcal{G}^\bullet$ of $\mathcal{O}$-modules
there exists a commutative diagram of complexes of $\mathcal{O}$-modules
$$
\xymatrix{
\mathcal{K}_1^\bullet \ar[d] \ar[r] &
\mathcal{K}_2^\bullet \ar[d] \ar[r] & \ldots \\
\tau_{\leq 1}\mathcal{G}^\bullet \ar[r] &
\tau_{\leq 2}\mathcal{G}^\bullet \ar[r] & \ldots
}
$$
with the following properties: (1) the vertical arrows are quasi-isomorphisms
and termwise surjective,
(2) each $\mathcal{K}_n^\bullet$ is a bounded above complex whose terms
are direct sums of $\mathcal{O}$-modules of the form $j_{U!}\mathcal{O}_U$, and
(3) the maps $\mathcal{K}_n^\bullet \to \mathcal{K}_{n + 1}^\bullet$ are
termwise split injections whose cokernels are direct sums of
$\mathcal{O}$-modules of the form $j_{U!}\mathcal{O}_U$. Moreover, the map
$\colim \mathcal{K}_n^\bullet \to \mathcal{G}^\bullet$ is a quasi-isomorphism.
\end{lemma}

\begin{proof}
The existence of the diagram and properties (1), (2), (3) follows immediately
from
Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat}
and
Derived Categories, Lemma \ref{derived-lemma-special-direct-system}.
The induced map
$\colim \mathcal{K}_n^\bullet \to \mathcal{G}^\bullet$
is a quasi-isomorphism because filtered colimits are exact.
\end{proof}

\begin{lemma}
\label{lemma-K-flat-resolution}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. For any complex
$\mathcal{G}^\bullet$ there exists a $K$-flat complex $\mathcal{K}^\bullet$
whose terms are flat $\mathcal{O}$-modules and a quasi-isomorphism
$\mathcal{K}^\bullet \to \mathcal{G}^\bullet$ which is termwise surjective.
\end{lemma}

\begin{proof}
Choose a diagram as in
Lemma \ref{lemma-resolution-by-direct-sums-extensions-by-zero}.
Each complex $\mathcal{K}_n^\bullet$ is a bounded
above complex of flat modules, see
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-flat}.
Hence $\mathcal{K}_n^\bullet$ is K-flat by
Lemma \ref{lemma-bounded-flat-K-flat}.
Thus $\colim \mathcal{K}_n^\bullet$ is K-flat by
Lemma \ref{lemma-colimit-K-flat}.
The induced map
$\colim \mathcal{K}_n^\bullet \to \mathcal{G}^\bullet$
is a quasi-isomorphism and termwise surjective by construction.
Property (3) of Lemma \ref{lemma-resolution-by-direct-sums-extensions-by-zero}
shows that $\colim \mathcal{K}_n^m$ is a direct sum of
flat modules and hence flat which proves the final assertion.
\end{proof}

\begin{lemma}
\label{lemma-derived-tor-quasi-isomorphism-other-side}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\alpha : \mathcal{P}^\bullet \to \mathcal{Q}^\bullet$ be a
quasi-isomorphism of K-flat complexes of $\mathcal{O}$-modules.
For every complex $\mathcal{F}^\bullet$ of $\mathcal{O}$-modules
the induced map
$$
\text{Tot}(\text{id}_{\mathcal{F}^\bullet} \otimes \alpha) :
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{P}^\bullet)
\longrightarrow
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{Q}^\bullet)
$$
is a quasi-isomorphism.
\end{lemma}

\begin{proof}
Choose a quasi-isomorphism $\mathcal{K}^\bullet \to \mathcal{F}^\bullet$
with $\mathcal{K}^\bullet$ a K-flat complex, see
Lemma \ref{lemma-K-flat-resolution}.
Consider the commutative diagram
$$
\xymatrix{
\text{Tot}(\mathcal{K}^\bullet
\otimes_\mathcal{O} \mathcal{P}^\bullet) \ar[r] \ar[d] &
\text{Tot}(\mathcal{K}^\bullet
\otimes_\mathcal{O} \mathcal{Q}^\bullet) \ar[d] \\
\text{Tot}(\mathcal{F}^\bullet
\otimes_\mathcal{O} \mathcal{P}^\bullet) \ar[r] &
\text{Tot}(\mathcal{F}^\bullet
\otimes_\mathcal{O} \mathcal{Q}^\bullet)
}
$$
The result follows as by
Lemma \ref{lemma-K-flat-quasi-isomorphism}
the vertical arrows and the top horizontal arrow are quasi-isomorphisms.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}^\bullet$ be an object of $D(\mathcal{O})$.
Choose a K-flat resolution $\mathcal{K}^\bullet \to \mathcal{F}^\bullet$, see
Lemma \ref{lemma-K-flat-resolution}.
By
Lemma \ref{lemma-derived-tor-exact}
we obtain an exact functor of triangulated categories
$$
K(\mathcal{O})
\longrightarrow
K(\mathcal{O}),
\quad
\mathcal{G}^\bullet
\longmapsto
\text{Tot}(\mathcal{G}^\bullet \otimes_\mathcal{O} \mathcal{K}^\bullet)
$$
By
Lemma \ref{lemma-K-flat-quasi-isomorphism}
this functor induces a functor
$D(\mathcal{O}) \to D(\mathcal{O})$ simply because
$D(\mathcal{O})$ is the localization of $K(\mathcal{O})$
at quasi-isomorphisms. By
Lemma \ref{lemma-derived-tor-quasi-isomorphism-other-side}
the resulting functor (up to isomorphism)
does not depend on the choice of the K-flat resolution.

\begin{definition}
\label{definition-derived-tor}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}^\bullet$ be an object of $D(\mathcal{O})$.
The {\it derived tensor product}
$$
- \otimes_\mathcal{O}^{\mathbf{L}} \mathcal{F}^\bullet :
D(\mathcal{O})
\longrightarrow
D(\mathcal{O})
$$
is the exact functor of triangulated categories described above.
\end{definition}

\noindent
It is clear from our explicit constructions that
there is a canonical isomorphism
$$
\mathcal{F}^\bullet \otimes_\mathcal{O}^{\mathbf{L}} \mathcal{G}^\bullet
\cong
\mathcal{G}^\bullet \otimes_\mathcal{O}^{\mathbf{L}} \mathcal{F}^\bullet
$$
for $\mathcal{G}^\bullet$ and $\mathcal{F}^\bullet$ in $D(\mathcal{O})$.
Hence when we write
$\mathcal{F}^\bullet \otimes_\mathcal{O}^{\mathbf{L}} \mathcal{G}^\bullet$
we will usually be agnostic about which variable we are using to
define the derived tensor product with.

\begin{definition}
\label{definition-tor}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}$, $\mathcal{G}$ be $\mathcal{O}$-modules.
The {\it Tor}'s of $\mathcal{F}$ and $\mathcal{G}$ are defined by
the formula
$$
\text{Tor}_p^\mathcal{O}(\mathcal{F}, \mathcal{G}) =
H^{-p}(\mathcal{F} \otimes_\mathcal{O}^\mathbf{L} \mathcal{G})
$$
with derived tensor product as defined above.
\end{definition}

\noindent
This definition implies that for every short exact sequence
of $\mathcal{O}$-modules
$0 \to \mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3 \to 0$
we have a long exact cohomology sequence
$$
\xymatrix{
\mathcal{F}_1 \otimes_\mathcal{O} \mathcal{G} \ar[r] &
\mathcal{F}_2 \otimes_\mathcal{O} \mathcal{G} \ar[r] &
\mathcal{F}_3 \otimes_\mathcal{O} \mathcal{G} \ar[r] & 0 \\
\text{Tor}_1^\mathcal{O}(\mathcal{F}_1, \mathcal{G}) \ar[r] &
\text{Tor}_1^\mathcal{O}(\mathcal{F}_2, \mathcal{G}) \ar[r] &
\text{Tor}_1^\mathcal{O}(\mathcal{F}_3, \mathcal{G}) \ar[ull]
}
$$
for every $\mathcal{O}$-module $\mathcal{G}$. This will be called
the long exact sequence of $\text{Tor}$ associated to the situation.

\begin{lemma}
\label{lemma-flat-tor-zero}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}$ be an $\mathcal{O}$-module.
The following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is a flat $\mathcal{O}$-module, and
\item $\text{Tor}_1^\mathcal{O}(\mathcal{F}, \mathcal{G}) = 0$
for every $\mathcal{O}$-module $\mathcal{G}$.
\end{enumerate}
\end{lemma}

\begin{proof}
If $\mathcal{F}$ is flat, then $\mathcal{F} \otimes_\mathcal{O} -$
is an exact functor and the satellites vanish. Conversely assume (2)
holds. Then if $\mathcal{G} \to \mathcal{H}$ is injective with cokernel
$\mathcal{Q}$, the long exact sequence of $\text{Tor}$ shows that
the kernel of
$\mathcal{F} \otimes_\mathcal{O} \mathcal{G} \to
\mathcal{F} \otimes_\mathcal{O} \mathcal{H}$
is a quotient of
$\text{Tor}_1^\mathcal{O}(\mathcal{F}, \mathcal{Q})$
which is zero by assumption. Hence $\mathcal{F}$ is flat.
\end{proof}

\begin{lemma}
\label{lemma-K-flat-flat-acyclic}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{K}^\bullet$
be a K-flat, acyclic complex with flat terms. Then
$\mathcal{F} = \Ker(\mathcal{K}^n \to \mathcal{K}^{n + 1})$
is a flat $\mathcal{O}$-module.
\end{lemma}

\begin{proof}
Observe that
$$
\ldots \to \mathcal{K}^{n - 2} \to \mathcal{K}^{n - 1} \to
\mathcal{F} \to 0
$$
is a flat resolution of our module $\mathcal{F}$. Since a bounded above complex
of flat modules is K-flat (Lemma \ref{lemma-bounded-flat-K-flat})
we may use this resolution to compute
$\text{Tor}_i(\mathcal{F}, \mathcal{G})$ for any
$\mathcal{O}$-module $\mathcal{G}$. On the one hand
$\mathcal{K}^\bullet \otimes_\mathcal{O}^\mathbf{L} \mathcal{G}$
is zero in $D(\mathcal{O})$ because $\mathcal{K}^\bullet$ is acyclic
and on the other hand it is represented by
$\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{G}$.
Hence we see that
$$
\mathcal{K}^{n - 3} \otimes_\mathcal{O} \mathcal{G} \to
\mathcal{K}^{n - 2} \otimes_\mathcal{O} \mathcal{G} \to
\mathcal{K}^{n - 1} \otimes_\mathcal{O} \mathcal{G}
$$
is exact. Thus $\text{Tor}_1(\mathcal{F}, \mathcal{G}) = 0$
and we conclude by Lemma \ref{lemma-flat-tor-zero}.
\end{proof}

\begin{lemma}
\label{lemma-factor-through-K-flat}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed space.
Let $a : \mathcal{K}^\bullet \to \mathcal{L}^\bullet$ be a map of complexes
of $\mathcal{O}$-modules. If $\mathcal{K}^\bullet$ is K-flat, then
there exist a complex $\mathcal{N}^\bullet$ and maps of complexes
$b : \mathcal{K}^\bullet \to \mathcal{N}^\bullet$
and $c : \mathcal{N}^\bullet \to \mathcal{L}^\bullet$ such that
\begin{enumerate}
\item $\mathcal{N}^\bullet$ is K-flat,
\item $c$ is a quasi-isomorphism,
\item $a$ is homotopic to $c \circ b$.
\end{enumerate}
If the terms of $\mathcal{K}^\bullet$ are flat, then we may choose
$\mathcal{N}^\bullet$, $b$, and $c$
such that the same is true for $\mathcal{N}^\bullet$.
\end{lemma}

\begin{proof}
We will use that the homotopy category $K(\textit{Mod}(\mathcal{O}))$
is a triangulated category, see Derived Categories, Proposition
\ref{derived-proposition-homotopy-category-triangulated}.
Choose a distinguished triangle
$\mathcal{K}^\bullet \to \mathcal{L}^\bullet \to
\mathcal{C}^\bullet \to \mathcal{K}^\bullet[1]$.
Choose a quasi-isomorphism $\mathcal{M}^\bullet \to \mathcal{C}^\bullet$ with
$\mathcal{M}^\bullet$ K-flat with flat terms, see
Lemma \ref{lemma-K-flat-resolution}.
By the axioms of triangulated categories,
we may fit the composition
$\mathcal{M}^\bullet \to \mathcal{C}^\bullet \to \mathcal{K}^\bullet[1]$
into a distinguished triangle
$\mathcal{K}^\bullet \to \mathcal{N}^\bullet \to
\mathcal{M}^\bullet \to \mathcal{K}^\bullet[1]$.
By Lemma \ref{lemma-K-flat-two-out-of-three} we see that
$\mathcal{N}^\bullet$ is K-flat.
Again using the axioms of triangulated categories,
we can choose a map $\mathcal{N}^\bullet \to \mathcal{L}^\bullet$ fitting into
the following morphism of distinghuised triangles
$$
\xymatrix{
\mathcal{K}^\bullet \ar[r] \ar[d] &
\mathcal{N}^\bullet \ar[r] \ar[d] &
\mathcal{M}^\bullet \ar[r] \ar[d] &
\mathcal{K}^\bullet[1] \ar[d] \\
\mathcal{K}^\bullet \ar[r] &
\mathcal{L}^\bullet \ar[r] &
\mathcal{C}^\bullet \ar[r] &
\mathcal{K}^\bullet[1]
}
$$
Since two out of three of the arrows are quasi-isomorphisms, so is
the third arrow $\mathcal{N}^\bullet \to \mathcal{L}^\bullet$
by the long exact sequences
of cohomology associated to these distinguished triangles
(or you can look at the image of this diagram in $D(\mathcal{O})$ and use
Derived Categories, Lemma \ref{derived-lemma-third-isomorphism-triangle}
if you like). This finishes the proof of (1), (2), and (3).
To prove the final assertion, we may choose $\mathcal{N}^\bullet$ such that
$\mathcal{N}^n \cong \mathcal{M}^n \oplus \mathcal{K}^n$, see
Derived Categories, Lemma
\ref{derived-lemma-improve-distinguished-triangle-homotopy}.
Hence we get the desired flatness
if the terms of $\mathcal{K}^\bullet$ are flat.
\end{proof}












\section{Derived pullback}
\label{section-derived-pullback}

\noindent
Let
$f : (\Sh(\mathcal{C}), \mathcal{O}) \to
(\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. We can use K-flat resolutions to define
a derived pullback functor
$$
Lf^* : D(\mathcal{O}') \to D(\mathcal{O})
$$

\begin{lemma}
\label{lemma-pullback-K-flat}
Let $f : (\Sh(\mathcal{C}'), \mathcal{O}') \to (\Sh(\mathcal{C}), \mathcal{O})$
be a morphism of ringed topoi. Let $\mathcal{K}^\bullet$ be a K-flat complex
of $\mathcal{O}$-modules whose terms are flat $\mathcal{O}$-modules. Then
$f^*\mathcal{K}^\bullet$ is a K-flat complex of $\mathcal{O}'$-modules whose
terms are flat $\mathcal{O}'$-modules.
\end{lemma}

\begin{proof}
The terms $f^*\mathcal{K}^n$ are flat $\mathcal{O}'$-modules by
Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-flat}.
Choose a diagram
$$
\xymatrix{
\mathcal{K}_1^\bullet \ar[d] \ar[r] &
\mathcal{K}_2^\bullet \ar[d] \ar[r] & \ldots \\
\tau_{\leq 1}\mathcal{K}^\bullet \ar[r] &
\tau_{\leq 2}\mathcal{K}^\bullet \ar[r] & \ldots
}
$$
as in Lemma \ref{lemma-resolution-by-direct-sums-extensions-by-zero}.
We will use all of the properties stated in the
lemma without further mention. Each $\mathcal{K}_n^\bullet$ is a bounded
above complex of flat modules, see
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-flat}.
Consider the short exact sequence of complexes
$$
0 \to \mathcal{M}^\bullet \to
\colim \mathcal{K}_n^\bullet \to
\mathcal{K}^\bullet \to 0
$$
defining $\mathcal{M}^\bullet$. By Lemmas \ref{lemma-bounded-flat-K-flat} and
\ref{lemma-colimit-K-flat} the complex $\colim \mathcal{K}_n^\bullet$
is K-flat and by Modules on Sites, Lemma \ref{sites-modules-lemma-colimits-flat}
it has flat terms. By Modules on Sites, Lemma \ref{sites-modules-lemma-flat-ses}
$\mathcal{M}^\bullet$ has flat terms, by
Lemma \ref{lemma-K-flat-two-out-of-three-ses}
$\mathcal{M}^\bullet$ is K-flat, and by the long exact
cohomology sequence $\mathcal{M}^\bullet$ is acyclic (because
the second arrow is a quasi-isomorphism). The pullback
$f^*(\colim \mathcal{K}_n^\bullet) = \colim f^*\mathcal{K}_n^\bullet$
is a colimit of bounded below complexes of flat $\mathcal{O}'$-modules
and hence is K-flat (by the same lemmas as above).
The pullback of our short exact sequence
$$
0 \to f^*\mathcal{M}^\bullet \to
f^*(\colim \mathcal{K}_n^\bullet) \to
f^*\mathcal{K}^\bullet \to 0
$$
is a short exact sequence of complexes by
Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-ses}.
Hence by Lemma \ref{lemma-K-flat-two-out-of-three-ses}
it suffices to show that $f^*\mathcal{M}^\bullet$
is K-flat. This reduces us to the case discussed in the next paragraph.

\medskip\noindent
Assume $\mathcal{K}^\bullet$ is acyclic as well as K-flat and
with flat terms. Then Lemma \ref{lemma-K-flat-flat-acyclic}
guarantees that all terms of $\tau_{\leq n}\mathcal{K}^\bullet$
are flat $\mathcal{O}$-modules. We choose a diagram as above and
we will use all the properties proven above for this diagram.
Denote $\mathcal{M}_n^\bullet$ the kernel of the map of complexes
$\mathcal{K}_n^\bullet \to \tau_{\leq n}\mathcal{K}^\bullet$
so that we have short exact sequences of complexes
$$
0 \to \mathcal{M}_n^\bullet \to \mathcal{K}_n^\bullet \to
\tau_{\leq n}\mathcal{K}^\bullet \to 0
$$
By Modules on Sites, Lemma \ref{sites-modules-lemma-flat-ses}
we see that the terms of the complex $\mathcal{M}_n^\bullet$ are flat.
Hence we see that $\mathcal{M} = \colim \mathcal{M}_n^\bullet$
is a filtered colimit of bounded below complexes of flat modules
in this case. Thus $f^*\mathcal{M}^\bullet$ is K-flat
(same argument as above) and we win.
\end{proof}

\begin{lemma}
\label{lemma-derived-base-change}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. There exists an exact functor
$$
Lf^* : D(\mathcal{O}') \longrightarrow D(\mathcal{O})
$$
of triangulated categories so that
$Lf^*\mathcal{K}^\bullet = f^*\mathcal{K}^\bullet$ for any
K-flat complex $\mathcal{K}^\bullet$ with flat terms and
in particular for any bounded above complex of flat $\mathcal{O}'$-modules.
\end{lemma}

\begin{proof}
To see this we use the general theory developed in
Derived Categories, Section \ref{derived-section-derived-functors}.
Set $\mathcal{D} = K(\mathcal{O}')$ and $\mathcal{D}' = D(\mathcal{O})$.
Let us write $F : \mathcal{D} \to \mathcal{D}'$ the exact functor
of triangulated categories defined by the rule
$F(\mathcal{G}^\bullet) = f^*\mathcal{G}^\bullet$.
We let $S$ be the set of quasi-isomorphisms in
$\mathcal{D} = K(\mathcal{O}')$.
This gives a situation as in
Derived Categories, Situation \ref{derived-situation-derived-functor}
so that
Derived Categories, Definition
\ref{derived-definition-right-derived-functor-defined}
applies. We claim that $LF$ is everywhere defined.
This follows from
Derived Categories, Lemma \ref{derived-lemma-find-existence-computes}
with $\mathcal{P} \subset \Ob(\mathcal{D})$ the collection
of K-flat complexes $\mathcal{K}^\bullet$ with flat terms.
Namely, (1) follows from Lemma \ref{lemma-K-flat-resolution}
and to see (2) we have to show that for a quasi-isomorphism
$\mathcal{K}_1^\bullet  \to \mathcal{K}_2^\bullet$ between
elements of $\mathcal{P}$ the map
$f^*\mathcal{K}_1^\bullet  \to f^*\mathcal{K}_2^\bullet$ is a
quasi-isomorphism. To see this write this as
$$
f^{-1}\mathcal{K}_1^\bullet \otimes_{f^{-1}\mathcal{O}'} \mathcal{O}
\longrightarrow
f^{-1}\mathcal{K}_2^\bullet \otimes_{f^{-1}\mathcal{O}'} \mathcal{O}
$$
The functor $f^{-1}$ is exact, hence the map
$f^{-1}\mathcal{K}_1^\bullet  \to f^{-1}\mathcal{K}_2^\bullet$ is a
quasi-isomorphism. The complexes
$f^{-1}\mathcal{K}_1^\bullet$ and $f^{-1}\mathcal{K}_2^\bullet$
are K-flat complexes of $f^{-1}\mathcal{O}'$-modules by
Lemma \ref{lemma-pullback-K-flat}
because we can consider the morphism of ringed topoi
$(\Sh(\mathcal{C}), f^{-1}\mathcal{O}') \to
(\Sh(\mathcal{C}'), \mathcal{O}')$. Hence
Lemma \ref{lemma-derived-tor-quasi-isomorphism-other-side}
guarantees that the displayed map is a quasi-isomorphism.
Thus we obtain a derived functor
$$
LF :
D(\mathcal{O}') = S^{-1}\mathcal{D}
\longrightarrow
\mathcal{D}' = D(\mathcal{O})
$$
see
Derived Categories, Equation (\ref{derived-equation-everywhere}).
Finally,
Derived Categories, Lemma \ref{derived-lemma-find-existence-computes}
also guarantees that
$LF(\mathcal{K}^\bullet) = F(\mathcal{K}^\bullet) = f^*\mathcal{K}^\bullet$
when $\mathcal{K}^\bullet$ is in $\mathcal{P}$.
The proof is finished by observing that
bounded above complexes of flat modules are in $\mathcal{P}$
by Lemma \ref{lemma-bounded-flat-K-flat}.
\end{proof}

\begin{lemma}
\label{lemma-derived-pullback-composition}
Consider morphisms of ringed topoi
$f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
and
$g : (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D}) \to
(\Sh(\mathcal{E}), \mathcal{O}_\mathcal{E})$.
Then $Lf^* \circ Lg^* = L(g \circ f)^*$ as functors
$D(\mathcal{O}_\mathcal{E}) \to D(\mathcal{O}_\mathcal{C})$.
\end{lemma}

\begin{proof}
Let $E$ be an object of $D(\mathcal{O}_\mathcal{E})$.
We may represent $E$ by a K-flat complex $\mathcal{K}^\bullet$
with flat terms, see Lemma \ref{lemma-K-flat-resolution}.
By construction $Lg^*E$ is computed by $g^*\mathcal{K}^\bullet$, see
Lemma \ref{lemma-derived-base-change}.
By Lemma \ref{lemma-pullback-K-flat} the complex
$g^*\mathcal{K}^\bullet$ is K-flat with flat terms.
Hence $Lf^*Lg^*E$ is represented by $f^*g^*\mathcal{K}^\bullet$.
Since also $L(g \circ f)^*E$ is represented by
$(g \circ f)^*\mathcal{K}^\bullet = f^*g^*\mathcal{K}^\bullet$
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-pullback-tensor-product}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{D}), \mathcal{O}')$
be a morphism of ringed topoi.
There is a canonical bifunctorial isomorphism
$$
Lf^*(
\mathcal{F}^\bullet \otimes_{\mathcal{O}'}^{\mathbf{L}} \mathcal{G}^\bullet
) =
Lf^*\mathcal{F}^\bullet 
\otimes_{\mathcal{O}}^{\mathbf{L}}
Lf^*\mathcal{G}^\bullet 
$$
for $\mathcal{F}^\bullet, \mathcal{G}^\bullet \in \Ob(D(\mathcal{O}'))$.
\end{lemma}

\begin{proof}
By our construction of derived pullback in
Lemma \ref{lemma-derived-base-change}.
and the existence of resolutions in
Lemma \ref{lemma-K-flat-resolution}
we may replace $\mathcal{F}^\bullet$ and $\mathcal{G}^\bullet$
by complexes of $\mathcal{O}'$-modules which are K-flat and have
flat terms. In this case
$\mathcal{F}^\bullet \otimes_{\mathcal{O}'}^{\mathbf{L}} \mathcal{G}^\bullet$
is just the total complex associated to the double complex
$\mathcal{F}^\bullet \otimes_{\mathcal{O}'} \mathcal{G}^\bullet$.
The complex
$\text{Tot}(\mathcal{F}^\bullet \otimes_{\mathcal{O}'} \mathcal{G}^\bullet)$
is K-flat with flat terms by Lemma \ref{lemma-tensor-product-K-flat} and
Modules on Sites, Lemma \ref{sites-modules-lemma-tensor-flats}.
Hence the isomorphism of the lemma comes from the isomorphism
$$
\text{Tot}(f^*\mathcal{F}^\bullet \otimes_{\mathcal{O}}
f^*\mathcal{G}^\bullet)
\longrightarrow
f^*\text{Tot}(\mathcal{F}^\bullet \otimes_{\mathcal{O}'} \mathcal{G}^\bullet)
$$
whose constituents are the isomorphisms
$f^*\mathcal{F}^p \otimes_{\mathcal{O}} f^*\mathcal{G}^q \to
f^*(\mathcal{F}^p \otimes_{\mathcal{O}'} \mathcal{G}^q)$ of
Modules on Sites, Lemma \ref{sites-modules-lemma-tensor-product-pullback}.
\end{proof}

\begin{lemma}
\label{lemma-variant-derived-pullback}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. There is a canonical bifunctorial
isomorphism
$$
\mathcal{F}^\bullet
\otimes_\mathcal{O}^{\mathbf{L}}
Lf^*\mathcal{G}^\bullet
=
\mathcal{F}^\bullet 
\otimes_{f^{-1}\mathcal{O}_Y}^{\mathbf{L}}
f^{-1}\mathcal{G}^\bullet 
$$
for $\mathcal{F}^\bullet$ in $D(\mathcal{O})$ and
$\mathcal{G}^\bullet$ in $D(\mathcal{O}')$.
\end{lemma}

\begin{proof}
Let $\mathcal{F}$ be an $\mathcal{O}$-module and let $\mathcal{G}$
be an $\mathcal{O}'$-module. Then
$\mathcal{F} \otimes_{\mathcal{O}} f^*\mathcal{G} =
\mathcal{F} \otimes_{f^{-1}\mathcal{O}'} f^{-1}\mathcal{G}$
because
$f^*\mathcal{G} =
\mathcal{O} \otimes_{f^{-1}\mathcal{O}'} f^{-1}\mathcal{G}$.
The lemma follows from this and the definitions.
\end{proof}











\begin{lemma}
\label{lemma-check-K-flat-stalks}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{K}^\bullet$ be a complex of $\mathcal{O}$-modules.
\begin{enumerate}
\item If $\mathcal{K}^\bullet$ is K-flat, then for every point $p$
of the site $\mathcal{C}$ the complex of $\mathcal{O}_p$-modules
$\mathcal{K}_p^\bullet$ is K-flat in the sense of
More on Algebra, Definition \ref{more-algebra-definition-K-flat}
\item If $\mathcal{C}$ has enough points, then the converse is true.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (2). If $\mathcal{C}$ has enough points and
$\mathcal{K}_p^\bullet$ is K-flat for all points $p$ of $\mathcal{C}$
then we see that $\mathcal{K}^\bullet$ is K-flat because $\otimes$ and
direct sums commute with taking stalks and because we can check exactness
at stalks, see
Modules on Sites, Lemma \ref{sites-modules-lemma-check-exactness-stalks}.

\medskip\noindent
Proof of (1). Assume $\mathcal{K}^\bullet$ is K-flat.
Choose a quasi-isomorphism $a : \mathcal{L}^\bullet \to \mathcal{K}^\bullet$
such that $\mathcal{L}^\bullet$ is K-flat with flat terms, see
Lemma \ref{lemma-K-flat-resolution}. Any pullback
of $\mathcal{L}^\bullet$ is K-flat, see
Lemma \ref{lemma-pullback-K-flat}. In particular the stalk
$\mathcal{L}_p^\bullet$ is a K-flat complex of $\mathcal{O}_p$-modules.
Thus the cone $C(a)$ on $a$ is a K-flat
(Lemma \ref{lemma-K-flat-two-out-of-three})
acyclic complex of $\mathcal{O}$-modules and it suffuces
to show the stalk of $C(a)$ is K-flat
(by More on Algebra, Lemma \ref{more-algebra-lemma-K-flat-two-out-of-three}).
Thus we may assume that $\mathcal{K}^\bullet$ is K-flat and acyclic.

\medskip\noindent
Assume $\mathcal{K}^\bullet$ is acyclic and K-flat. Before continuing
we replace the site $\mathcal{C}$ by another one as in
Sites, Lemma \ref{sites-lemma-topos-good-site}
to insure that $\mathcal{C}$ has all finite
limits. This implies the category of neighbourhoods of $p$ is filtered
(Sites, Lemma \ref{sites-lemma-neighbourhoods-directed})
and the colimit defining the stalk of a sheaf is filtered.
Let $M$ be a finitely presented $\mathcal{O}_p$-module.
It suffices to show that $\mathcal{K}^\bullet \otimes_{\mathcal{O}_p} M$
is acyclic, see
More on Algebra, Lemma \ref{more-algebra-lemma-universally-acyclic-K-flat}.
Since $\mathcal{O}_p$ is the filtered colimit of $\mathcal{O}(U)$
where $U$ runs over the neighbourhoods of $p$, we
can find a neighbourhood $(U, x)$ of $p$ and a finitely
presented $\mathcal{O}(U)$-module $M'$ whose base change
to $\mathcal{O}_p$ is $M$, see
Algebra, Lemma \ref{algebra-lemma-colimit-category-fp-modules}.
By Lemma \ref{lemma-restriction-K-flat}
we may replace $\mathcal{C}, \mathcal{O}, \mathcal{K}^\bullet$
by $\mathcal{C}/U, \mathcal{O}_U, \mathcal{K}^\bullet|_U$.
We conclude that we may assume there exists an $\mathcal{O}$-module
$\mathcal{F}$ such that $M \cong \mathcal{F}_p$.
Since $\mathcal{K}^\bullet$ is K-flat and acyclic,
we see that $\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{F}$
is acyclic (as it computes the derived tensor product by
definition). Taking stalks is an exact functor, hence we get that
$\mathcal{K}^\bullet \otimes_{\mathcal{O}_p} M$
is acyclic as desired.
\end{proof}

\begin{lemma}
\label{lemma-pullback-K-flat-points}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. If $\mathcal{C}$ has enough points, then
the pullback of a K-flat complex of
$\mathcal{O}'$-modules is a K-flat complex of $\mathcal{O}$-modules.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-check-K-flat-stalks},
Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-stalk},
and
More on Algebra, Lemma \ref{more-algebra-lemma-base-change-K-flat}.
\end{proof}

\begin{lemma}
\label{lemma-tensor-pull-compatibility}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $\mathcal{K}^\bullet$ and $\mathcal{M}^\bullet$
be complexes of $\mathcal{O}_\mathcal{D}$-modules.
The diagram
$$
\xymatrix{
Lf^*(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
\mathcal{M}^\bullet) \ar[r] \ar[d] &
Lf^*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
\mathcal{M}^\bullet) \ar[d] \\
Lf^*\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L}
Lf^*\mathcal{M}^\bullet \ar[d] &
f^*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
\mathcal{M}^\bullet) \ar[d] \\
f^*\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L}
f^*\mathcal{M}^\bullet \ar[r] &
\text{Tot}(f^*\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}
f^*\mathcal{M}^\bullet)
}
$$
commutes.
\end{lemma}

\begin{proof}
We will use the existence of K-flat resolutions with flat terms
(Lemma \ref{lemma-K-flat-resolution}), we will use that derived pullback
is computed by such complexes (Lemma \ref{lemma-derived-base-change}),
and that pullbacks preserve these properties
(Lemma \ref{lemma-pullback-K-flat}). If we choose such
resolutions $\mathcal{P}^\bullet \to \mathcal{K}^\bullet$
and $\mathcal{Q}^\bullet \to \mathcal{M}^\bullet$, then
we see that
$$
\xymatrix{
Lf^*\text{Tot}(\mathcal{P}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
\mathcal{Q}^\bullet) \ar[r] \ar[d] &
Lf^*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
\mathcal{M}^\bullet) \ar[d] \\
f^*\text{Tot}(\mathcal{P}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
\mathcal{Q}^\bullet) \ar[d] \ar[r] &
f^*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
\mathcal{M}^\bullet) \ar[d] \\
\text{Tot}(f^*\mathcal{P}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}
f^*\mathcal{Q}^\bullet) \ar[r] &
\text{Tot}(f^*\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}
f^*\mathcal{M}^\bullet)
}
$$
commutes. However, now the left hand side of the diagram
is the left hand side of the diagram by our choice of
$\mathcal{P}^\bullet$ and $\mathcal{Q}^\bullet$ and
Lemma \ref{lemma-tensor-product-K-flat}.
\end{proof}









\section{Cohomology of unbounded complexes}
\label{section-unbounded}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
The category $\textit{Mod}(\mathcal{O})$ is a Grothendieck
abelian category: it has all colimits,
filtered colimits are exact, and it has a generator, namely
$$
\bigoplus\nolimits_{U \in \Ob(\mathcal{C})} j_{U!}\mathcal{O}_U,
$$
see Modules on Sites, Section \ref{sites-modules-section-kernels} and
Lemmas \ref{sites-modules-lemma-j-shriek-flat} and
\ref{sites-modules-lemma-module-quotient-flat}.
By Injectives, Theorem
\ref{injectives-theorem-K-injective-embedding-grothendieck}
for every complex $\mathcal{F}^\bullet$ of $\mathcal{O}$-modules
there exists an injective quasi-isomorphism
$\mathcal{F}^\bullet \to \mathcal{I}^\bullet$ to a K-injective complex
of $\mathcal{O}$-modules and moreover this embedding can be chosen
functorial in $\mathcal{F}^\bullet$. It follows from
Derived Categories, Lemma \ref{derived-lemma-enough-K-injectives-implies}
that
\begin{enumerate}
\item any exact functor $F : K(\textit{Mod}(\mathcal{O})) \to \mathcal{D}$
into a trianguated category $\mathcal{D}$ has a right derived functor
$RF : D(\mathcal{O}) \to \mathcal{D}$,
\item for any additive functor
$F : \textit{Mod}(\mathcal{O}) \to \mathcal{A}$
into an abelian category $\mathcal{A}$ we consider the exact functor
$F : K(\textit{Mod}(\mathcal{O})) \to D(\mathcal{A})$ induced by $F$
and we obtain a right derived functor
$RF : D(\mathcal{O}) \to K(\mathcal{A})$.
\end{enumerate}
By construction we have $RF(\mathcal{F}^\bullet) = F(\mathcal{I}^\bullet)$
where $\mathcal{F}^\bullet \to \mathcal{I}^\bullet$ is as above.

\medskip\noindent
Here are some examples of the above:
\begin{enumerate}
\item The functor $\Gamma(\mathcal{C}, -) : \textit{Mod}(\mathcal{O}) \to
\text{Mod}_{\Gamma(\mathcal{C}, \mathcal{O})}$ gives rise to
$$
R\Gamma(\mathcal{C}, -) :
D(\mathcal{O})
\longrightarrow
D(\Gamma(\mathcal{C}, \mathcal{O}))
$$
We shall use the notation
$H^i(\mathcal{C}, K) = H^i(R\Gamma(\mathcal{C}, K))$ for cohomology.
\item For an object $U$ of $\mathcal{C}$ we consider the functor
$\Gamma(U, -) : \textit{Mod}(\mathcal{O}) \to
\text{Mod}_{\Gamma(U, \mathcal{O})}$. This gives rise to
$$
R\Gamma(U, -) : D(\mathcal{O}) \to D(\Gamma(U, \mathcal{O}))
$$
We shall use the notation
$H^i(U, K) = H^i(R\Gamma(U, K))$ for cohomology.
\item For a morphism of ringed topoi
$f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{D}), \mathcal{O}')$
we consider the functor
$f_* : \textit{Mod}(\mathcal{O}) \to \textit{Mod}(\mathcal{O}')$
which gives rise to the total direct image
$$
Rf_* : D(\mathcal{O}) \longrightarrow D(\mathcal{O}')
$$
on unbounded derived categories.
\end{enumerate}

\begin{lemma}
\label{lemma-adjoint}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{D}), \mathcal{O}')$
be a morphism of ringed topoi.
The functor $Rf_*$ defined above and
the functor $Lf^*$ defined in
Lemma \ref{lemma-derived-base-change} are adjoint:
$$
\Hom_{D(\mathcal{O})}(Lf^*\mathcal{G}^\bullet, \mathcal{F}^\bullet)
=
\Hom_{D(\mathcal{O}')}(\mathcal{G}^\bullet, Rf_*\mathcal{F}^\bullet)
$$
bifunctorially in $\mathcal{F}^\bullet \in \Ob(D(\mathcal{O}))$ and
$\mathcal{G}^\bullet \in \Ob(D(\mathcal{O}'))$.
\end{lemma}

\begin{proof}
This follows formally from the fact that $Rf_*$ and $Lf^*$ exist, see
Derived Categories, Lemma \ref{derived-lemma-derived-adjoint-functors}.
\end{proof}

\begin{lemma}
\label{lemma-derived-pushforward-composition}
Let
$f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
and
$g : (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D}) \to
(\Sh(\mathcal{E}), \mathcal{O}_\mathcal{E})$
be morphisms of ringed topoi.
Then $Rg_* \circ Rf_* = R(g \circ f)_*$ as functors
$D(\mathcal{O}_\mathcal{C}) \to D(\mathcal{O}_\mathcal{E})$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-adjoint} we see that $Rg_* \circ Rf_*$
is adjoint to $Lf^* \circ Lg^*$. We have
$Lf^* \circ Lg^* = L(g \circ f)^*$ by
Lemma \ref{lemma-derived-pullback-composition}
and hence by
uniqueness of adjoint functors we have $Rg_* \circ Rf_* = R(g \circ f)_*$.
\end{proof}

\begin{remark}
\label{remark-base-change}
The construction of unbounded derived functor $Lf^*$ and $Rf_*$
allows one to construct the base change map in full generality.
Namely, suppose that
$$
\xymatrix{
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'})
\ar[r]_{g'} \ar[d]_{f'} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^f \\
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'})
\ar[r]^g &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
is a commutative diagram of ringed topoi. Let $K$ be an object of
$D(\mathcal{O}_\mathcal{C})$.
Then there exists a canonical base change map
$$
Lg^*Rf_*K \longrightarrow R(f')_*L(g')^*K
$$
in $D(\mathcal{O}_{\mathcal{D}'})$. Namely, this map is adjoint to a map
$L(f')^*Lg^*Rf_*K \to L(g')^*K$.
Since $L(f')^* \circ Lg^* = L(g')^* \circ Lf^*$ we see this is the same
as a map $L(g')^*Lf^*Rf_*K \to L(g')^*K$
which we can take to be $L(g')^*$ of the adjunction map
$Lf^*Rf_*K \to K$.
\end{remark}

\begin{remark}
\label{remark-compose-base-change}
Consider a commutative diagram
$$
\xymatrix{
(\Sh(\mathcal{B}'), \mathcal{O}_{\mathcal{B}'})
\ar[r]_k \ar[d]_{f'} &
(\Sh(\mathcal{B}), \mathcal{O}_\mathcal{B}) \ar[d]^f \\
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'})
\ar[r]^l \ar[d]_{g'} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^g \\
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'})
\ar[r]^m &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D}) \\
}
$$
of ringed topoi. Then the base change maps of
Remark \ref{remark-base-change}
for the two squares compose to give the base
change map for the outer rectangle. More precisely,
the composition
\begin{align*}
Lm^* \circ R(g \circ f)_*
& =
Lm^* \circ Rg_* \circ Rf_* \\
& \to Rg'_* \circ Ll^* \circ Rf_* \\
& \to Rg'_* \circ Rf'_* \circ Lk^* \\
& = R(g' \circ f')_* \circ Lk^*
\end{align*}
is the base change map for the rectangle. We omit the verification.
\end{remark}

\begin{remark}
\label{remark-compose-base-change-horizontal}
Consider a commutative diagram
$$
\xymatrix{
(\Sh(\mathcal{C}''), \mathcal{O}_{\mathcal{C}''})
\ar[r]_{g'} \ar[d]_{f''} &
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'})
\ar[r]_g \ar[d]_{f'} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^f \\
(\Sh(\mathcal{D}''), \mathcal{O}_{\mathcal{D}''})
\ar[r]^{h'} &
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'})
\ar[r]^h &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
of ringed topoi. Then the base change maps of
Remark \ref{remark-base-change}
for the two squares compose to give the base
change map for the outer rectangle. More precisely,
the composition
\begin{align*}
L(h \circ h')^* \circ Rf_*
& =
L(h')^* \circ Lh^* \circ Rf_* \\
& \to L(h')^* \circ Rf'_* \circ Lg^* \\
& \to Rf''_* \circ L(g')^* \circ Lg^* \\
& = Rf''_* \circ L(g \circ g')^*
\end{align*}
is the base change map for the rectangle. We omit the verification.
\end{remark}



\begin{lemma}
\label{lemma-adjoints-push-pull-compatibility}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $\mathcal{K}^\bullet$
be a complex of $\mathcal{O}_\mathcal{C}$-modules.
The diagram
$$
\xymatrix{
Lf^*f_*\mathcal{K}^\bullet \ar[r] \ar[d] &
f^*f_*\mathcal{K}^\bullet \ar[d] \\
Lf^*Rf_*\mathcal{K}^\bullet \ar[r] &
\mathcal{K}^\bullet
}
$$
coming from $Lf^* \to f^*$ on complexes, $f_* \to Rf_*$ on complexes,
and adjunction $Lf^* \circ Rf_* \to \text{id}$
commutes in $D(\mathcal{O}_\mathcal{C})$.
\end{lemma}

\begin{proof}
We will use the existence of K-flat resolutions and
K-injective resolutions, see Lemmas
\ref{lemma-K-flat-resolution}, \ref{lemma-derived-base-change}, and
\ref{lemma-pullback-K-flat} and the discussion above.
Choose a quasi-isomorphism
$\mathcal{K}^\bullet \to \mathcal{I}^\bullet$ where $\mathcal{I}^\bullet$
is K-injective as a complex of $\mathcal{O}_\mathcal{C}$-modules.
Choose a quasi-isomorphism $\mathcal{Q}^\bullet \to f_*\mathcal{I}^\bullet$
where $\mathcal{Q}^\bullet$ is a K-flat complex of
$\mathcal{O}_\mathcal{D}$-modules with flat terms.
We can choose a K-flat complex of
$\mathcal{O}_\mathcal{D}$-modules $\mathcal{P}^\bullet$ with flat terms
and a diagram of morphisms of complexes
$$
\xymatrix{
\mathcal{P}^\bullet \ar[r] \ar[d] &
f_*\mathcal{K}^\bullet \ar[d] \\
\mathcal{Q}^\bullet \ar[r] & f_*\mathcal{I}^\bullet
}
$$
commutative up to homotopy where the top horizontal arrow
is a quasi-isomorphism. Namely, we can first choose such a
diagram for some complex $\mathcal{P}^\bullet$ because
the quasi-isomorphisms form a multiplicative system in
the homotopy category of complexes and then we can choose
a resolution of $\mathcal{P}^\bullet$ by a K-flat complex with flat terms.
Taking pullbacks we obtain a diagram of morphisms of complexes
$$
\xymatrix{
f^*\mathcal{P}^\bullet \ar[r] \ar[d] &
f^*f_*\mathcal{K}^\bullet \ar[d] \ar[r] &
\mathcal{K}^\bullet \ar[d] \\
f^*\mathcal{Q}^\bullet \ar[r] &
f^*f_*\mathcal{I}^\bullet \ar[r] &
\mathcal{I}^\bullet
}
$$
commutative up to homotopy. The outer rectangle witnesses the
truth of the statement in the lemma.
\end{proof}



\begin{remark}
\label{remark-cup-product}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of
ringed topoi. The adjointness of $Lf^*$ and $Rf_*$ allows us to construct
a relative cup product
$$
Rf_*K \otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L} Rf_*L
\longrightarrow
Rf_*(K \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L} L)
$$
in $D(\mathcal{O}_\mathcal{D})$ for all $K, L$ in $D(\mathcal{O}_\mathcal{C})$.
Namely, this map is adjoint to a map
$Lf^*(Rf_*K \otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L} Rf_*L) \to
K \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L} L$ for which we can take the
composition of the isomorphism
$Lf^*(Rf_*K \otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L} Rf_*L) =
Lf^*Rf_*K \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L} Lf^*Rf_*L$
(Lemma \ref{lemma-pullback-tensor-product})
with the map
$Lf^*Rf_*K \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L} Lf^*Rf_*L
\to K \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L} L$
coming from the counit $Lf^* \circ Rf_* \to \text{id}$.
\end{remark}

\begin{lemma}
\label{lemma-torsion}
Let $\mathcal{C}$ be a site. Let $\mathcal{A} \subset \textit{Ab}(\mathcal{C})$
denote the Serre subcategory consisting of torsion abelian sheaves.
Then the functor $D(\mathcal{A}) \to D_\mathcal{A}(\mathcal{C})$
is an equivalence.
\end{lemma}

\begin{proof}
A key observation is that an injective abelian sheaf $\mathcal{I}$
is divisible. Namely, if $s \in \mathcal{I}(U)$ is a local section,
then we interpret $s$ as a map
$s : j_{U!}\mathbf{Z} \to \mathcal{I}$ and we apply the
defining property of an injective object to
the injective map of sheaves $n : j_{U!}\mathbf{Z} \to j_{U!}\mathbf{Z}$
to see that there exists an $s' \in \mathcal{I}(U)$ with $ns' = s$.

\medskip\noindent
For a sheaf $\mathcal{F}$ denote $\mathcal{F}_{tor}$ its torsion subsheaf.
We claim that if $\mathcal{I}^\bullet$ is a complex of injective abelian
sheaves whose cohomology sheaves are torsion, then
$$
\mathcal{I}^\bullet_{tor} \to \mathcal{I}^\bullet
$$
is a quasi-isomorphism. Namely, by flatness of $\mathbf{Q}$ over $\mathbf{Z}$
we have
$$
H^p(\mathcal{I}^\bullet) \otimes_\mathbf{Z} \mathbf{Q} =
H^p(\mathcal{I}^\bullet \otimes_\mathbf{Z} \mathbf{Q})
$$
which is zero because the cohomology sheaves are torsion.
By divisibility (shown above) we see that
$\mathcal{I}^\bullet \to \mathcal{I}^\bullet \otimes_\mathbf{Z} \mathbf{Q}$
is surjective with kernel $\mathcal{I}^\bullet_{tor}$.
The claim follows from the long exact sequence of cohomology sheaves
associated to the short exact sequence you get.

\medskip\noindent
To prove the lemma we will construct right adjoint
$T : D(\mathcal{C}) \to D(\mathcal{A})$. Namely, given $K$
in $D(\mathcal{C})$ we can represent $K$ by a K-injective complex
$\mathcal{I}^\bullet$ whose cohomology sheaves are injective, see
Injectives, Theorem
\ref{injectives-theorem-K-injective-embedding-grothendieck}.
Then we set $T(K) = \mathcal{I}^\bullet_{tor}$, in other words,
$T$ is the right derived functor of taking torsion.
The functor $T$ is a right adjoint to
$i : D(\mathcal{A}) \to D_\mathcal{A}(\mathcal{C})$.
This readily follows from the observation that
if $\mathcal{F}^\bullet$ is a complex of torsion sheaves, then
$$
\Hom_{K(\mathcal{A})}(\mathcal{F}^\bullet, I^\bullet_{tor}) =
\Hom_{K(\textit{Ab}(\mathcal{C}))}(\mathcal{F}^\bullet, I^\bullet)
$$
in particular $\mathcal{I}^\bullet_{tor}$ is a K-injective complex
of $\mathcal{A}$. Some details omitted; in case of doubt, it also
follows from the more general
Derived Categories, Lemma \ref{derived-lemma-derived-adjoint-functors}.
Our claim above gives that $L = T(i(L))$ for $L$ in $D(\mathcal{A})$
and $i(T(K)) = K$ if $K$ is in $D_\mathcal{A}(\mathcal{C})$.
Using Categories, Lemma \ref{categories-lemma-adjoint-fully-faithful}
the result follows.
\end{proof}




\section{Some properties of K-injective complexes}
\label{section-properties-K-injective}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an
object of $\mathcal{C}$. Denote
$j : (\Sh(\mathcal{C}/U), \mathcal{O}_U) \to (\Sh(\mathcal{C}), \mathcal{O})$
the corresponding localization morphism. The pullback functor $j^*$ is exact
as it is just the restriction functor. Thus derived pullback $Lj^*$ is
computed on any complex by simply restricting the complex. We often
simply denote the corresponding functor
$$
D(\mathcal{O}) \to D(\mathcal{O}_U),
\quad
E \mapsto j^*E = E|_U
$$
Similarly, extension by zero
$j_! : \textit{Mod}(\mathcal{O}_U) \to \textit{Mod}(\mathcal{O})$ (see
Modules on Sites, Definition
\ref{sites-modules-definition-localize-ringed-site})
is an exact functor
(Modules on Sites, Lemma \ref{sites-modules-lemma-extension-by-zero-exact}).
Thus it induces a functor
$$
j_! : D(\mathcal{O}_U) \to D(\mathcal{O}), \quad
F \mapsto j_!F
$$
by simply applying $j_!$ to any complex representing the object $F$.

\begin{lemma}
\label{lemma-restrict-K-injective-to-open}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an object of
$\mathcal{C}$. The restriction of a K-injective complex of
$\mathcal{O}$-modules to $\mathcal{C}/U$ is a K-injective complex of
$\mathcal{O}_U$-modules.
\end{lemma}

\begin{proof}
Follows immediately from
Derived Categories, Lemma \ref{derived-lemma-adjoint-preserve-K-injectives}
and the fact that the restriction functor has the
exact left adjoint $j_!$. See discussion above.
\end{proof}

\begin{lemma}
\label{lemma-unbounded-cohomology-of-open}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U \in \Ob(\mathcal{C})$.
For $K$ in $D(\mathcal{O})$ we have
$H^p(U, K) = H^p(\mathcal{C}/U, K|_{\mathcal{C}/U})$.
\end{lemma}

\begin{proof}
Let $\mathcal{I}^\bullet$ be a K-injective complex of $\mathcal{O}$-modules
representing $K$. Then
$$
H^q(U, K) = H^q(\Gamma(U, \mathcal{I}^\bullet)) =
H^q(\Gamma(\mathcal{C}/U, \mathcal{I}^\bullet|_{\mathcal{C}/U}))
$$
by construction of cohomology. By
Lemma \ref{lemma-restrict-K-injective-to-open}
the complex $\mathcal{I}^\bullet|_{\mathcal{C}/U}$ is a K-injective complex
representing $K|_{\mathcal{C}/U}$ and the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-sheafification-cohomology}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K$ be an object of
$D(\mathcal{O})$. The sheafification of
$$
U \mapsto H^q(U, K) = H^q(\mathcal{C}/U, K|_{\mathcal{C}/U})
$$
is the $q$th cohomology sheaf $H^q(K)$ of $K$.
\end{lemma}

\begin{proof}
The equality $H^q(U, K) = H^q(\mathcal{C}/U, K|_{\mathcal{C}/U})$
holds by Lemma \ref{lemma-unbounded-cohomology-of-open}.
Choose a K-injective complex $\mathcal{I}^\bullet$ representing $K$.
Then
$$
H^q(U, K) =
\frac{\Ker(\mathcal{I}^q(U) \to \mathcal{I}^{q + 1}(U))}
{\Im(\mathcal{I}^{q - 1}(U) \to \mathcal{I}^q(U))}.
$$
by our construction of cohomology. Since
$H^q(K) = \Ker(\mathcal{I}^q \to \mathcal{I}^{q + 1})/
\Im(\mathcal{I}^{q - 1} \to \mathcal{I}^q)$ the result is clear.
\end{proof}

\begin{lemma}
\label{lemma-restrict-direct-image-open}
Let $f : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$ be a morphism of ringed sites
corresponding to the continuous functor $u : \mathcal{D} \to \mathcal{C}$.
Given $V \in \mathcal{D}$, set $U = u(V)$ and denote
$g : (\mathcal{C}/U, \mathcal{O}_U) \to (\mathcal{D}/V, \mathcal{O}_V)$
the induced morphism of ringed sites
(Modules on Sites, Lemma
\ref{sites-modules-lemma-localize-morphism-ringed-sites}).
Then $(Rf_*E)|_{\mathcal{D}/V} = Rg_*(E|_{\mathcal{C}/U})$
for $E$ in $D(\mathcal{O}_\mathcal{C})$.
\end{lemma}

\begin{proof}
Represent $E$ by a K-injective complex $\mathcal{I}^\bullet$ of
$\mathcal{O}_\mathcal{C}$-modules. Then
$Rf_*(E) = f_*\mathcal{I}^\bullet$
and $Rg_*(E|_{\mathcal{C}/U}) = g_*(\mathcal{I}^\bullet|_{\mathcal{C}/U})$ by
Lemma \ref{lemma-restrict-K-injective-to-open}.
Since it is clear that
$(f_*\mathcal{F})|_{\mathcal{D}/V} = g_*(\mathcal{F}|_{\mathcal{C}/U})$
for any sheaf $\mathcal{F}$ on $\mathcal{C}$
(see Modules on Sites, Lemma
\ref{sites-modules-lemma-localize-morphism-ringed-sites} or the more basic
Sites, Lemma \ref{sites-lemma-localize-morphism})
the result follows.
\end{proof}

\begin{lemma}
\label{lemma-Leray-unbounded}
Let $f : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$ be a morphism of ringed sites
corresponding to the continuous functor $u : \mathcal{D} \to \mathcal{C}$.
Then $R\Gamma(\mathcal{D}, -) \circ Rf_* = R\Gamma(\mathcal{C}, -)$ as
functors $D(\mathcal{O}_\mathcal{C}) \to D(\Gamma(\mathcal{O}_\mathcal{D}))$.
More generally, for $V \in \mathcal{D}$ with $U = u(V)$
we have $R\Gamma(U, -) = R\Gamma(V, -) \circ Rf_*$.
\end{lemma}

\begin{proof}
Consider the punctual topos $pt$ endowed with $\mathcal{O}_{pt}$
given by the ring $\Gamma(\mathcal{O}_\mathcal{D})$.
There is a canonical morphism
$(\mathcal{D}, \mathcal{O}_\mathcal{D}) \to (pt, \mathcal{O}_{pt})$
of ringed topoi inducing the identification on global sections of
structure sheaves. Then
$D(\mathcal{O}_{pt}) = D(\Gamma(\mathcal{O}_\mathcal{D}))$.
The assertion
$R\Gamma(\mathcal{D}, -) \circ Rf_* = R\Gamma(\mathcal{C}, -)$
follows from Lemma \ref{lemma-derived-pushforward-composition}
applied to
$$
(\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D}) \to (pt, \mathcal{O}_{pt})
$$
The second (more general) statement follows from the first statement
after applying Lemma \ref{lemma-restrict-direct-image-open}.
\end{proof}

\begin{lemma}
\label{lemma-unbounded-describe-higher-direct-images}
Let $f : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$ be a morphism of ringed sites
corresponding to the continuous functor $u : \mathcal{D} \to \mathcal{C}$.
Let $K$ be in $D(\mathcal{O}_\mathcal{C})$. Then $H^i(Rf_*K)$ is the sheaf
associated to the presheaf
$$
V \mapsto H^i(u(V), K) = H^i(V, Rf_*K)
$$
\end{lemma}

\begin{proof}
The equality $H^i(u(V), K) = H^i(V, Rf_*K)$ follows upon taking
cohomology from the second statement in
Lemma \ref{lemma-Leray-unbounded}. Then the statement on sheafification
follows from Lemma \ref{lemma-sheafification-cohomology}.
\end{proof}

\begin{lemma}
\label{lemma-modules-abelian-unbounded}
Let $(\mathcal{C}, \mathcal{O}_\mathcal{C})$ be a ringed site.
Let $K$ be an object of $D(\mathcal{O}_\mathcal{C})$
and denote $K_{ab}$ its image in $D(\underline{\mathbf{Z}}_\mathcal{C})$.
\begin{enumerate}
\item There is a canonical map
$R\Gamma(\mathcal{C}, K) \to R\Gamma(\mathcal{C}, K_{ab})$
which is an isomorphism in $D(\textit{Ab})$.
\item For any $U \in \mathcal{C}$ there is a canonical map
$R\Gamma(U, K) \to R\Gamma(U, K_{ab})$
which is an isomorphism in $D(\textit{Ab})$.
\item Let $f : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$ be a morphism of ringed sites.
There is a canonical map $Rf_*K \to Rf_*(K_{ab})$ which
is an isomorphism in $D(\underline{\mathbf{Z}}_\mathcal{D})$.
\end{enumerate}
\end{lemma}

\begin{proof}
The map is constructed as follows. Choose a K-injective complex
$\mathcal{I}^\bullet$ representing $K$. Choose a quasi-isomorpism
$\mathcal{I}^\bullet \to \mathcal{J}^\bullet$ where $\mathcal{J}^\bullet$
is a K-injective complex of abelian groups. Then the map in
(1) is given by
$\Gamma(\mathcal{C}, \mathcal{I}^\bullet) \to
\Gamma(\mathcal{C}, \mathcal{J}^\bullet)$
(2) is given by
$\Gamma(U, \mathcal{I}^\bullet) \to \Gamma(U, \mathcal{J}^\bullet)$
and the map in (3) is given by
$f_*\mathcal{I}^\bullet \to f_*\mathcal{J}^\bullet$.
To show that these maps are isomorphisms, it suffices to prove
they induce isomorphisms on cohomology groups and cohomology sheaves.
By Lemmas \ref{lemma-unbounded-cohomology-of-open} and
\ref{lemma-unbounded-describe-higher-direct-images}
it suffices to show that the map
$$
H^0(\mathcal{C}, K) \longrightarrow H^0(\mathcal{C}, K_{ab})
$$
is an isomorphism. Observe that
$$
H^0(\mathcal{C}, K) =
\Hom_{D(\mathcal{O}_\mathcal{C})}(\mathcal{O}_\mathcal{C}, K)
$$
and similarly for the other group. Choose any complex $\mathcal{K}^\bullet$
of $\mathcal{O}_\mathcal{C}$-modules representing $K$. By construction of the
derived category as a localization we have
$$
\Hom_{D(\mathcal{O}_\mathcal{C})}(\mathcal{O}_\mathcal{C}, K) =
\colim_{s : \mathcal{F}^\bullet \to \mathcal{O}_\mathcal{C}}
\Hom_{K(\mathcal{O}_\mathcal{C})}(\mathcal{F}^\bullet, \mathcal{K}^\bullet)
$$
where the colimit is over quasi-isomorphisms $s$ of complexes of
$\mathcal{O}_\mathcal{C}$-modules. Similarly, we have
$$
\Hom_{D(\underline{\mathbf{Z}}_\mathcal{C})}
(\underline{\mathbf{Z}}_\mathcal{C}, K) =
\colim_{s : \mathcal{G}^\bullet \to \underline{\mathbf{Z}}_\mathcal{C}}
\Hom_{K(\underline{\mathbf{Z}}_\mathcal{C})}
(\mathcal{G}^\bullet, \mathcal{K}^\bullet)
$$
Next, we observe that the quasi-isomorphisms
$s : \mathcal{G}^\bullet \to \underline{\mathbf{Z}}_\mathcal{C}$
with $\mathcal{G}^\bullet$ bounded above complex of flat
$\underline{\mathbf{Z}}_\mathcal{C}$-modules is cofinal in the system.
(This follows from Modules on Sites, Lemma
\ref{sites-modules-lemma-module-quotient-flat} and
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution};
see discussion in Section \ref{section-flat}.)
Hence we can construct an inverse to the map
$H^0(\mathcal{C}, K) \longrightarrow H^0(\mathcal{C}, K_{ab})$
by representing an element $\xi \in H^0(\mathcal{C}, K_{ab})$ by a pair
$$
(s : \mathcal{G}^\bullet \to \underline{\mathbf{Z}}_\mathcal{C},
a : \mathcal{G}^\bullet \to \mathcal{K}^\bullet)
$$
with $\mathcal{G}^\bullet$ a bounded above complex of flat
$\underline{\mathbf{Z}}_\mathcal{C}$-modules and sending this to
$$
(\mathcal{G}^\bullet \otimes_{\underline{\mathbf{Z}}_\mathcal{C}}
\mathcal{O}_\mathcal{C}
\to \mathcal{O}_\mathcal{C},
\mathcal{G}^\bullet  \otimes_{\underline{\mathbf{Z}}_\mathcal{C}}
\mathcal{O}_\mathcal{C}
\to \mathcal{K}^\bullet)
$$
The only thing to note here is that the first arrow
is a quasi-isomorphism by
Lemmas \ref{lemma-derived-tor-quasi-isomorphism-other-side} and
\ref{lemma-bounded-flat-K-flat}.
We omit the detailed verification that this construction
is indeed an inverse.
\end{proof}

\begin{lemma}
\label{lemma-adjoint-lower-shriek-restrict}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an
object of $\mathcal{C}$. Denote
$j : (\Sh(\mathcal{C}/U), \mathcal{O}_U) \to (\Sh(\mathcal{C}), \mathcal{O})$
the corresponding localization morphism. The restriction functor
$D(\mathcal{O}) \to D(\mathcal{O}_U)$ is a right adjoint to
extension by zero $j_! : D(\mathcal{O}_U) \to D(\mathcal{O})$.
\end{lemma}

\begin{proof}
We have to show that
$$
\Hom_{D(\mathcal{O})}(j_!E, F) = \Hom_{D(\mathcal{O}_U)}(E, F|_U)
$$
Choose a complex $\mathcal{E}^\bullet$ of $\mathcal{O}_U$-modules
representing $E$ and choose
a K-injective complex $\mathcal{I}^\bullet$ representing $F$.
By Lemma \ref{lemma-restrict-K-injective-to-open} the complex
$\mathcal{I}^\bullet|_U$ is K-injective as well. Hence we see that
the formula above becomes
$$
\Hom_{D(\mathcal{O})}(j_!\mathcal{E}^\bullet, \mathcal{I}^\bullet) =
\Hom_{D(\mathcal{O}_U)}(\mathcal{E}^\bullet, \mathcal{I}^\bullet|_U)
$$
which holds as $|_U$ and $j_!$ are adjoint functors
(Modules on Sites, Lemma \ref{sites-modules-lemma-extension-by-zero})
and
Derived Categories, Lemma \ref{derived-lemma-K-injective}.
\end{proof}

\begin{lemma}
\label{lemma-j-shriek-and-tensor}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U \in \Ob(\mathcal{C})$.
For $L$ in $D(\mathcal{O}_U)$ and $K$ in $D(\mathcal{O})$ we have
$j_!L \otimes_\mathcal{O}^\mathbf{L} K =
j_!(L \otimes_{\mathcal{O}_U}^\mathbf{L} K|_U)$.
\end{lemma}

\begin{proof}
Represent $L$ by a complex of $\mathcal{O}_U$-modules and $K$ by a K-flat
complexe of $\mathcal{O}$-modules and apply
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-and-tensor}.
Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-K-injective-flat}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a flat morphism
of ringed topoi. If $\mathcal{I}^\bullet$ is a K-injective
complex of $\mathcal{O}_\mathcal{C}$-modules, then
$f_*\mathcal{I}^\bullet$ is K-injective
as a complex of $\mathcal{O}_\mathcal{D}$-modules.
\end{lemma}

\begin{proof}
This is true because
$$
\Hom_{K(\mathcal{O}_\mathcal{D})}(\mathcal{F}^\bullet, f_*\mathcal{I}^\bullet)
=
\Hom_{K(\mathcal{O}_\mathcal{C})}(f^*\mathcal{F}^\bullet, \mathcal{I}^\bullet)
$$
by
Modules on Sites, Lemma
\ref{sites-modules-lemma-adjoint-pullback-pushforward-modules}
and the fact that $f^*$ is exact as $f$ is assumed to be flat.
\end{proof}

\begin{lemma}
\label{lemma-hom-K-injective}
Let $\mathcal{C}$ be a site. Let $\mathcal{O} \to \mathcal{O}'$ be a map
of sheaves of rings. If $\mathcal{I}^\bullet$ is a K-injective complex of
$\mathcal{O}$-modules, then
$\SheafHom_\mathcal{O}(\mathcal{O}', \mathcal{I}^\bullet)$
is a K-injective complex of $\mathcal{O}'$-modules.
\end{lemma}

\begin{proof}
This is true because
$\Hom_{K(\mathcal{O}')}(\mathcal{G}^\bullet,
\Hom_\mathcal{O}(\mathcal{O}', \mathcal{I}^\bullet)) =
\Hom_{K(\mathcal{O})}(\mathcal{G}^\bullet, \mathcal{I}^\bullet)$
by Modules on Sites, Lemma \ref{sites-modules-lemma-adjoint-hom-restrict}.
\end{proof}






\section{Localization and cohomology}
\label{section-localization}

\noindent
Let $\mathcal{C}$ be a site. Let $f : X \to Y$ be a morphism of $\mathcal{C}$.
Then we obtain a morphism of topoi
$$
j_{X/Y} : \Sh(\mathcal{C}/X) \longrightarrow \Sh(\mathcal{C}/Y)
$$
See Sites, Sections \ref{sites-section-localize} and
\ref{sites-section-more-localize}. Some questions about
cohomology are easier for this type of morphisms of topoi.
Here is an example where we get a trivial type of base change theorem.

\begin{lemma}
\label{lemma-localize-cartesian-square}
Let $\mathcal{C}$ be a site. Let
$$
\xymatrix{
X' \ar[d] \ar[r] & X \ar[d] \\
Y' \ar[r] & Y
}
$$
be a cartesian diagram of $\mathcal{C}$. Then we have
$j_{Y'/Y}^{-1} \circ Rj_{X/Y, *} = Rj_{X'/Y', *} \circ j_{X'/X}^{-1}$
as functors $D(\mathcal{C}/X) \to D(\mathcal{C}/Y')$.
\end{lemma}

\begin{proof}
Let $E \in D(\mathcal{C}/X)$. Choose a K-injective complex
$\mathcal{I}^\bullet$ of abelian sheaves on $\mathcal{C}/X$
representing $E$. By Lemma \ref{lemma-restrict-K-injective-to-open}
we see that $j_{X'/X}^{-1}\mathcal{I}^\bullet$ is K-injective too.
Hence we may compute $Rj_{X'/Y'}(j_{X'/X}^{-1}E)$ by
$j_{X'/Y', *}j_{X'/X}^{-1}\mathcal{I}^\bullet$.
Thus we see that the equality holds by
Sites, Lemma \ref{sites-lemma-localize-cartesian-square}.
\end{proof}

\noindent
If we have a ringed site $(\mathcal{C}, \mathcal{O})$
and a morphism $f : X \to Y$ of $\mathcal{C}$, then $j_{X/Y}$
becomes a morphism of ringed topoi
$$
j_{X/Y} :
(\Sh(\mathcal{C}/X), \mathcal{O}_X)
\longrightarrow
(\Sh(\mathcal{C}/Y), \mathcal{O}_Y)
$$
See Modules on Sites, Lemma \ref{sites-modules-lemma-relocalize}.

\begin{lemma}
\label{lemma-localize-cartesian-square-modules}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$$
\xymatrix{
X' \ar[d] \ar[r] & X \ar[d] \\
Y' \ar[r] & Y
}
$$
be a cartesian diagram of $\mathcal{C}$. Then we have
$j_{Y'/Y}^* \circ Rj_{X/Y, *} = Rj_{X'/Y', *} \circ j_{X'/X}^*$
as functors
$D(\mathcal{O}_X) \to D(\mathcal{O}_{Y'})$.
\end{lemma}

\begin{proof}
Since $j_{Y'/Y}^{-1}\mathcal{O}_Y = \mathcal{O}_{Y'}$ we have
$j_{Y'/Y}^* = Lj_{Y'/Y}^* = j_{Y'/Y}^{-1}$. Similarly we have
$j_{X'/X}^* = Lj_{X'/X}^* = j_{X'/X}^{-1}$. Thus by
Lemma \ref{lemma-modules-abelian-unbounded} it suffices
to prove the result on derived categories of abelian sheaves
which we did in
Lemma \ref{lemma-localize-cartesian-square}.
\end{proof}












\section{Inverse systems and cohomology}
\label{section-inverse-systems}

\noindent
We prove some results on inverse systems of sheaves of modules.

\begin{lemma}
\label{lemma-ML-general}
Let $I$ be an ideal of a ring $A$. Let $\mathcal{C}$ be a site.
Let
$$
\ldots \to \mathcal{F}_3 \to \mathcal{F}_2 \to \mathcal{F}_1
$$
be an inverse system of sheaves of $A$-modules on $\mathcal{C}$
such that $\mathcal{F}_n = \mathcal{F}_{n + 1}/I^n\mathcal{F}_{n + 1}$.
Let $p \geq 0$. Assume
$$
\bigoplus\nolimits_{n \geq 0} H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{n + 1})
$$
satisfies the ascending chain condition as a graded
$\bigoplus_{n \geq 0} I^n/I^{n + 1}$-module.
Then the inverse system $M_n = H^p(\mathcal{C}, \mathcal{F}_n)$ satisfies the
Mittag-Leffler condition\footnote{In fact, there exists
a $c \geq 0$ such that $\Im(M_n \to M_{n - c})$ is the stable image
for all $n \geq c$.}.
\end{lemma}

\begin{proof}
Set $N_n = H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{n + 1})$ and let
$\delta_n : M_n \to N_n$ be the boundary map on cohomology
coming from the short exact sequence
$0 \to I^n\mathcal{F}_{n + 1} \to \mathcal{F}_{n + 1} \to \mathcal{F}_n \to 0$.
Then $\bigoplus \Im(\delta_n) \subset \bigoplus N_n$ is a graded submodule.
Namely, if $s \in M_n$ and $f \in I^m$, then we have a commutative diagram
$$
\xymatrix{
0 \ar[r] &
I^n\mathcal{F}_{n + 1} \ar[d]_f \ar[r] &
\mathcal{F}_{n + 1} \ar[d]_f \ar[r] &
\mathcal{F}_n \ar[d]_f \ar[r] & 0 \\
0 \ar[r] &
I^{n + m}\mathcal{F}_{n + m + 1} \ar[r] &
\mathcal{F}_{n + m + 1} \ar[r] &
\mathcal{F}_{n + m} \ar[r] & 0
}
$$
The middle vertical map is given by lifting a local section of
$\mathcal{F}_{n + 1}$ to a section of $\mathcal{F}_{n + m + 1}$
and then multiplying by $f$; similarly for the other vertical arrows.
We conclude that $\delta_{n + m}(fs) = f \delta_n(s)$.
By assumption we can find $s_j \in M_{n_j}$, $j = 1, \ldots, N$
such that $\delta_{n_j}(s_j)$
generate $\bigoplus \Im(\delta_n)$ as a graded module. Let $n > c = \max(n_j)$.
Let $s \in M_n$. Then we can find $f_j \in I^{n - n_j}$ such that
$\delta_n(s) = \sum f_j \delta_{n_j}(s_j)$. We conclude that
$\delta(s - \sum f_j s_j) = 0$, i.e., we can find $s' \in M_{n + 1}$
mapping to $s - \sum f_js_j$ in $M_n$. It follows that
$$
\Im(M_{n + 1} \to M_{n - c}) = \Im(M_n \to M_{n - c})
$$
Namely, the elements $f_js_j$ map to zero in $M_{n - c}$.
This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-ML-general-better}
Let $I$ be an ideal of a ring $A$. Let $\mathcal{C}$ be a site. Let
$$
\ldots \to \mathcal{F}_3 \to \mathcal{F}_2 \to \mathcal{F}_1
$$
be an inverse system of $A$-modules on $\mathcal{C}$
such that $\mathcal{F}_n = \mathcal{F}_{n + 1}/I^n\mathcal{F}_{n + 1}$.
Let $p \geq 0$. Given $n$ define
$$
N_n =
\bigcap\nolimits_{m \geq n}
\Im\left(
H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{m + 1}) \to
H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{n + 1})
\right)
$$
If $\bigoplus N_n$ satisfies the ascending chain condition as a graded
$\bigoplus_{n \geq 0} I^n/I^{n + 1}$-module, then the inverse system
$M_n = H^p(\mathcal{C}, \mathcal{F}_n)$ satisfies the Mittag-Leffler
condition\footnote{In fact, there exists
a $c \geq 0$ such that $\Im(M_n \to M_{n - c})$ is the stable image
for all $n \geq c$.}.
\end{lemma}

\begin{proof}
The proof is exactly the same as the proof of Lemma \ref{lemma-ML-general}.
In fact, the result will follow from the arguments given there
as soon as we show that
$\bigoplus N_n$ is a graded $\bigoplus_{n \geq 0} I^n/I^{n + 1}$-submodule
of $\bigoplus H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{n + 1})$
and that the boundary maps
$\delta_n : M_n \to H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{n + 1})$
have image contained in $N_n$.

\medskip\noindent
Suppose that $\xi \in N_n$ and $f \in I^k$.
Choose $m \gg n + k$. Choose
$\xi' \in H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{m + 1})$ lifting
$\xi$. We consider the diagram
$$
\xymatrix{
0 \ar[r] &
I^n\mathcal{F}_{m + 1} \ar[d]_f \ar[r] &
\mathcal{F}_{m + 1} \ar[d]_f \ar[r] &
\mathcal{F}_n \ar[d]_f \ar[r] & 0 \\
0 \ar[r] &
I^{n + k}\mathcal{F}_{m + 1} \ar[r] &
\mathcal{F}_{m + 1} \ar[r] &
\mathcal{F}_{n + k} \ar[r] & 0
}
$$
constructed as in the proof of Lemma \ref{lemma-ML-general}.
We get an induced map on cohomology and we see that
$f \xi' \in H^{p + 1}(\mathcal{C}, I^{n + k}\mathcal{F}_{m + 1})$
maps to $f \xi$. Since this is true for all $m \gg n + k$
we see that $f\xi$ is in $N_{n + k}$ as desired.

\medskip\noindent
To see the boundary maps $\delta_n$ have image contained in $N_n$
we consider the diagrams
$$
\xymatrix{
0 \ar[r] &
I^n\mathcal{F}_{m + 1} \ar[d] \ar[r] &
\mathcal{F}_{m + 1} \ar[d] \ar[r] &
\mathcal{F}_n \ar[d] \ar[r] & 0 \\
0 \ar[r] &
I^n\mathcal{F}_{n + 1} \ar[r] &
\mathcal{F}_{n + 1} \ar[r] &
\mathcal{F}_n \ar[r] & 0
}
$$
for $m \geq n$. Looking at the induced maps on cohomology we conclude.
\end{proof}

\begin{lemma}
\label{lemma-topology-I-adic-general}
Let $I$ be an ideal of a ring $A$. Let $\mathcal{C}$ be a site. Let
$$
\ldots \to \mathcal{F}_3 \to \mathcal{F}_2 \to \mathcal{F}_1
$$
be an inverse system of sheaves of $A$-modules on $\mathcal{C}$ such that
$\mathcal{F}_n = \mathcal{F}_{n + 1}/I^n\mathcal{F}_{n + 1}$.
Let $p \geq 0$. Assume
$$
\bigoplus\nolimits_{n \geq 0} H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1})
$$
satisfies the ascending chain condition as a graded
$\bigoplus_{n \geq 0} I^n/I^{n + 1}$-module.
Then the limit topology on $M = \lim H^p(\mathcal{C}, \mathcal{F}_n)$
is the $I$-adic topology.
\end{lemma}

\begin{proof}
Set $F^n = \Ker(M \to H^p(\mathcal{C}, \mathcal{F}_n))$ for $n \geq 1$ and
$F^0 = M$.
Observe that $I F^n \subset F^{n + 1}$. In particular $I^n M \subset F^n$.
Hence the $I$-adic topology is finer than the limit topology. For
the converse, we will show that given $n$
there exists an $m \geq n$ such that $F^m \subset I^nM$\footnote{In fact,
there exist a $c \geq 0$ such that $F^{n + c} \subset I^nM$ for all $n$.}.
We have injective maps
$$
F^n/F^{n + 1} \longrightarrow H^p(\mathcal{C}, \mathcal{F}_{n + 1})
$$
whose image is contained in the image of
$H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1}) \to
H^p(\mathcal{C}, \mathcal{F}_{n + 1})$.
Denote
$$
E_n \subset H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1})
$$
the inverse image of $F^n/F^{n + 1}$. Then $\bigoplus E_n$ is
a graded $\bigoplus I^n/I^{n + 1}$-submodule of
$\bigoplus H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1})$ and
$\bigoplus E_n \to \bigoplus F^n/F^{n + 1}$ is a homomorphism of graded
modules; details omitted. By assumption $\bigoplus E_n$ is generated by
finitely many homogeneous elements over $\bigoplus I^n/I^{n + 1}$.
Since $E_n \to F^n/F^{n + 1}$ is surjective, we see that
the same thing is true of $\bigoplus F^n/F^{n + 1}$.
Hence we can find $r$ and $c_1, \ldots, c_r \geq 0$ and
$a_i \in F^{c_i}$ whose images in $\bigoplus F^n/F^{n + 1}$ generate.
Set $c = \max(c_i)$.

\medskip\noindent
For $n \geq c$ we claim that $I F^n = F^{n + 1}$. The claim shows that
$F^{n + c} = I^nF^c \subset I^nM$ as desired. To prove the claim
suppose $a \in F^{n + 1}$. The image of
$a$ in $F^{n + 1}/F^{n + 2}$ is a linear combination
of our $a_i$. Therefore $a  - \sum f_i a_i \in F^{n + 2}$
for some $f_i \in I^{n + 1 - c_i}$. Since
$I^{n + 1 - c_i} = I \cdot I^{n - c_i}$ as $n \geq c_i$ we can write
$f_i = \sum g_{i, j} h_{i, j}$ with $g_{i, j} \in I$
and $h_{i, j}a_i \in F^n$. Thus we see that
$F^{n + 1} = F^{n + 2} + IF^n$.
A simple induction argument gives $F^{n + 1} = F^{n + e} + IF^n$
for all $e > 0$. It follows that $IF^n$ is dense in $F^{n + 1}$.
Choose generators $k_1, \ldots, k_r$ of $I$ and consider
the continuous map
$$
u : (F^n)^{\oplus r} \longrightarrow F^{n + 1},\quad
(x_1, \ldots, x_r) \mapsto \sum k_i x_i
$$
(in the limit topology).
By the above the image of $(F^m)^{\oplus r}$ under $u$ is dense in
$F^{m + 1}$ for all $m \geq n$. By the open mapping lemma
(More on Algebra, Lemma \ref{more-algebra-lemma-open-mapping}) we find
that $u$ is open. Hence $u$ is surjective. Hence $IF^n = F^{n + 1}$
for $n \geq c$. This concludes the proof.
\end{proof}

\begin{lemma}
\label{lemma-topology-I-adic-general-better}
Let $I$ be an ideal of a ring $A$. Let $\mathcal{C}$ be a site. Let
$$
\ldots \to \mathcal{F}_3 \to \mathcal{F}_2 \to \mathcal{F}_1
$$
be an inverse system of sheaves of $A$-modules on $\mathcal{C}$ such that
$\mathcal{F}_n = \mathcal{F}_{n + 1}/I^n\mathcal{F}_{n + 1}$.
Let $p \geq 0$. Given $n$ define
$$
N_n =
\bigcap\nolimits_{m \geq n}
\Im\left(
H^p(\mathcal{C}, I^n\mathcal{F}_{m + 1}) \to
H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1})
\right)
$$
If $\bigoplus N_n$ satisfies the ascending chain condition as a graded
$\bigoplus_{n \geq 0} I^n/I^{n + 1}$-module, then
the limit topology on $M = \lim H^p(\mathcal{C}, \mathcal{F}_n)$
is the $I$-adic topology.
\end{lemma}

\begin{proof}
The proof is exactly the same as the proof of
Lemma \ref{lemma-topology-I-adic-general}.
In fact, the result will follow from the arguments given there
as soon as we show that
$\bigoplus N_n$ is a graded $\bigoplus_{n \geq 0} I^n/I^{n + 1}$-submodule
of $\bigoplus H^{p + 1}(\mathcal{C}, I^n\mathcal{F}_{n + 1})$
and that $F^n/F^{n + 1} \subset H^p(\mathcal{C}, \mathcal{F}_{n + 1})$
is contained in the image of $N_n \to H^p(\mathcal{C}, \mathcal{F}_{n + 1})$.
In the proof of Lemma \ref{lemma-ML-general-better}
we have seen the statement on the module structure.

\medskip\noindent
Let $t \in F^n$. Choose an element
$s \in H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1})$
which maps to the image of $t$ in $H^p(\mathcal{C}, \mathcal{F}_{n + 1})$.
We have
to show that $s$ is in $N_n$. Now $F^n$ is the kernel of the map from
$M \to H^p(\mathcal{C}, \mathcal{F}_n)$ hence for all $m \geq n$ we can map $t$
to an element $t_m \in H^p(\mathcal{C}, \mathcal{F}_{m + 1})$ which maps
to zero in $H^p(\mathcal{C}, \mathcal{F}_n)$. Consider the cohomology sequence
$$
H^{p - 1}(\mathcal{C}, \mathcal{F}_n) \to
H^p(\mathcal{C}, I^n\mathcal{F}_{m + 1}) \to
H^p(\mathcal{C}, \mathcal{F}_{m + 1}) \to
H^p(\mathcal{C}, \mathcal{F}_n)
$$
coming from the short exact sequence
$0 \to I^n\mathcal{F}_{m + 1} \to \mathcal{F}_{m + 1} \to \mathcal{F}_n \to 0$.
We can choose $s_m \in H^p(\mathcal{C}, I^n\mathcal{F}_{m + 1})$
mapping to $t_m$.
Comparing the sequence above with the one for $m = n$ we see that
$s_m$ maps to $s$ up to an element in the image of
$H^{p - 1}(\mathcal{C}, \mathcal{F}_n) \to
H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1})$.
However, this map factors through the map
$H^p(\mathcal{C}, I^n\mathcal{F}_{m + 1}) \to
H^p(\mathcal{C}, I^n\mathcal{F}_{n + 1})$
and we see that $s$ is in the image as desired.
\end{proof}












\section{Derived and homotopy limits}
\label{section-derived-limits}

\noindent
Let $\mathcal{C}$ be a site. Consider the category
$\mathcal{C} \times \mathbf{N}$ with
$\Mor((U, n), (V, m)) = \emptyset$ if $n > m$ and
$\Mor((U, n), (V, m)) = \Mor(U, V)$ else. We endow this with the
structure of a site by letting coverings
be families $\{(U_i, n) \to (U, n)\}$ such that
$\{U_i \to U\}$ is a covering of $\mathcal{C}$.
Then the reader verifies immediately that
sheaves on $\mathcal{C} \times \mathbf{N}$ are the same thing
as inverse systems of sheaves on $\mathcal{C}$.
In particular $\textit{Ab}(\mathcal{C} \times \mathbf{N})$
is inverse systems of abelian sheaves on $\mathcal{C}$.
Consider now the functor
$$
\lim : \textit{Ab}(\mathcal{C} \times \mathbf{N}) \to \textit{Ab}(\mathcal{C})
$$
which takes an inverse system to its limit. This is nothing but
$g_*$ where $g : \Sh(\mathcal{C} \times \mathbf{N}) \to \Sh(\mathcal{C})$
is the morphism of topoi associated to the continuous and cocontinuous functor
$\mathcal{C} \times \mathbf{N} \to \mathcal{C}$. (Observe that
$g^{-1}$ assigns to a sheaf on $\mathcal{C}$ the corresponding
constant inverse system.)

\medskip\noindent
By the general machinery explained above we obtain a derived functor
$$
R\lim = Rg_* : D(\mathcal{C} \times \mathbf{N}) \to D(\mathcal{C}).
$$
As indicated this functor is often denoted $R\lim$.

\medskip\noindent
On the other hand, the continuous and cocontinuous functors
$\mathcal{C} \to \mathcal{C} \times \mathbf{N}$,
$U \mapsto (U, n)$ define morphisms of topoi
$i_n : \Sh(\mathcal{C}) \to \Sh(\mathcal{C} \times \mathbf{N})$.
Of course $i_n^{-1}$ is the functor which picks the $n$th term of
the inverse system. Thus there are transformations of functors
$i_{n + 1}^{-1} \to i_n^{-1}$. Hence given
$K \in D(\mathcal{C} \times \mathbf{N})$ we get
$K_n = i_n^{-1}K \in D(\mathcal{C})$ and maps $K_{n + 1} \to K_n$.
In Derived Categories, Definition \ref{derived-definition-derived-limit}
we have defined the notion of a homotopy limit
$$
R\lim K_n \in D(\mathcal{C})
$$
We claim the two notions agree (as far as it makes sense).

\begin{lemma}
\label{lemma-derived-limit-is-ok}
Let $\mathcal{C}$ be a site. Let $K$ be an object of
$D(\mathcal{C} \times \mathbf{N})$. Set $K_n = i_n^{-1}K$ as above.
Then
$$
R\lim K \cong R\lim K_n
$$
in $D(\mathcal{C})$.
\end{lemma}

\begin{proof}
To calculate $R\lim$ on an object $K$ of $D(\mathcal{C} \times \mathbf{N})$
we choose a K-injective representative $\mathcal{I}^\bullet$ whose terms are
injective objects of $\textit{Ab}(\mathcal{C} \times \mathbf{N})$, see
Injectives, Theorem
\ref{injectives-theorem-K-injective-embedding-grothendieck}.
We may and do think of $\mathcal{I}^\bullet$ as an inverse system of
complexes $(\mathcal{I}_n^\bullet)$ and then we see that
$$
R\lim K = \lim \mathcal{I}_n^\bullet
$$
where the right hand side is the termwise inverse limit.

\medskip\noindent
Let $\mathcal{J} = (\mathcal{J}_n)$ be an injective object of
$\textit{Ab}(\mathcal{C} \times \mathbf{N})$. The morphisms
$(U, n) \to (U, n + 1)$ are monomorphisms of
$\mathcal{C} \times \mathbf{N}$, hence
$\mathcal{J}(U, n + 1) \to \mathcal{J}(U, n)$ is surjective
(Lemma \ref{lemma-restriction-along-monomorphism-surjective}).
It follows that $\mathcal{J}_{n + 1} \to \mathcal{J}_n$ is
surjective as a map of presheaves.

\medskip\noindent
Note that the functor $i_n^{-1}$ has an exact left adjoint $i_{n, !}$.
Namely, $i_{n, !}\mathcal{F}$ is the inverse system
$\ldots 0 \to 0 \to \mathcal{F} \to \ldots \to \mathcal{F}$.
Thus the complexes $i_n^{-1}\mathcal{I}^\bullet = \mathcal{I}_n^\bullet$
are K-injective by
Derived Categories, Lemma \ref{derived-lemma-adjoint-preserve-K-injectives}.

\medskip\noindent
Because we chose our K-injective complex to have injective terms
we conclude that
$$
0 \to  \lim \mathcal{I}_n^\bullet \to \prod \mathcal{I}_n^\bullet
\to \prod \mathcal{I}_n^\bullet \to 0
$$
is a short exact sequence of complexes of abelian sheaves as it
is a short exact sequence of complexes of abelian presheaves.
Moreover, the products in the middle and the right represent
the products in $D(\mathcal{C})$, see
Injectives, Lemma \ref{injectives-lemma-derived-products} and its
proof (this is where we use that $\mathcal{I}_n^\bullet$ is K-injective).
Thus $R\lim K$ is a homotopy limit of the inverse system $(K_n)$
by definition of homotopy limits in triangulated categories.
\end{proof}

\begin{lemma}
\label{lemma-RGamma-commutes-with-Rlim}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. The functors
$R\Gamma(\mathcal{C}, -)$ and $R\Gamma(U, -)$ for $U \in \Ob(\mathcal{C})$
commute with $R\lim$. Moreover, there are
short exact sequences
$$
0 \to
R^1\lim H^{m - 1}(U, K_n) \to H^m(U, R\lim K_n) \to
\lim H^m(U, K_n) \to 0
$$
for any inverse system $(K_n)$ in $D(\mathcal{O})$ and $m \in \mathbf{Z}$.
Similar for $H^m(\mathcal{C}, R\lim K_n)$.
\end{lemma}

\begin{proof}
The first statement follows from
Injectives, Lemma \ref{injectives-lemma-RF-commutes-with-Rlim}.
Then we may apply 
More on Algebra, Remark \ref{more-algebra-remark-compare-derived-limit}
to $R\lim R\Gamma(U, K_n) = R\Gamma(U, R\lim K_n)$ to get the short
exact sequences.
\end{proof}

\begin{lemma}
\label{lemma-Rf-commutes-with-Rlim}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. Then $Rf_*$ commutes with $R\lim$, i.e.,
$Rf_*$ commutes with derived limits.
\end{lemma}

\begin{proof}
Let $(K_n)$ be an inverse system of objects of $D(\mathcal{O})$.
By induction on $n$ we may choose actual complexes $\mathcal{K}_n^\bullet$
of $\mathcal{O}$-modules and maps of complexes
$\mathcal{K}_{n + 1}^\bullet \to \mathcal{K}_n^\bullet$ representing the
maps $K_{n + 1} \to K_n$ in $D(\mathcal{O})$. In other words, there exists
an object $K$ in $D(\mathcal{C} \times \mathbf{N})$ whose associated inverse
system is the given one. Next, consider the commutative diagram
$$
\xymatrix{
\Sh(\mathcal{C} \times \mathbf{N}) \ar[r]_g \ar[d]_{f \times 1} &
\Sh(\mathcal{C}) \ar[d]_f \\
\Sh(\mathcal{C}' \times \mathbf{N}) \ar[r]^{g'} &
\Sh(\mathcal{C}')
}
$$
of morphisms of topoi. It follows that
$R\lim R(f \times 1)_*K = Rf_* R\lim K$. Working through the definitions
and using Lemma \ref{lemma-derived-limit-is-ok}
we obtain that $R\lim (Rf_*K_n) = Rf_*(R\lim K_n)$.

\medskip\noindent
Alternate proof in case $\mathcal{C}$ has enough points. Consider the defining
distinguished triangle
$$
R\lim K_n \to \prod K_n \to \prod K_n
$$
in $D(\mathcal{O})$. Applying the exact functor $Rf_*$ we obtain
the distinguished triangle
$$
Rf_*(R\lim K_n) \to Rf_*\left(\prod K_n\right) \to Rf_*\left(\prod K_n\right)
$$
in $D(\mathcal{O}')$. Thus we see that it suffices to prove that
$Rf_*$ commutes with products in the derived category (which are not just
given by products of complexes, see
Injectives, Lemma \ref{injectives-lemma-derived-products}).
However, since $Rf_*$ is a right adjoint by Lemma \ref{lemma-adjoint}
this follows formally (see
Categories, Lemma \ref{categories-lemma-adjoint-exact}).
Caution: Note that we cannot apply
Categories, Lemma \ref{categories-lemma-adjoint-exact}
directly as $R\lim K_n$ is not a limit in $D(\mathcal{O})$.
\end{proof}

\begin{remark}
\label{remark-discuss-derived-limit}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $(K_n)$ be an inverse
system in $D(\mathcal{O})$. Set $K = R\lim K_n$. For each $n$ and $m$
let $\mathcal{H}^m_n = H^m(K_n)$ be the $m$th cohomology sheaf of
$K_n$ and similarly set $\mathcal{H}^m = H^m(K)$. Let us denote
$\underline{\mathcal{H}}^m_n$ the presheaf
$$
U \longmapsto \underline{\mathcal{H}}^m_n(U) = H^m(U, K_n)
$$
Similarly we set $\underline{\mathcal{H}}^m(U) = H^m(U, K)$.
By Lemma \ref{lemma-sheafification-cohomology} we see that
$\mathcal{H}^m_n$ is the sheafification of
$\underline{\mathcal{H}}^m_n$ and $\mathcal{H}^m$ is the
sheafification of $\underline{\mathcal{H}}^m$.
Here is a diagram
$$
\xymatrix{
K \ar@{=}[d] &
\underline{\mathcal{H}}^m \ar[d] \ar[r] & 
\mathcal{H}^m \ar[d] \\
R\lim K_n &
\lim \underline{\mathcal{H}}^m_n \ar[r] & 
\lim \mathcal{H}^m_n
}
$$
In general it may not be the case that
$\lim \mathcal{H}^m_n$ is the sheafification of
$\lim \underline{\mathcal{H}}^m_n$.
If $U \in \mathcal{C}$, then we have short exact
sequences
\begin{equation}
\label{equation-ses-Rlim-over-U}
0 \to
R^1\lim \underline{\mathcal{H}}^{m - 1}_n(U) \to
\underline{\mathcal{H}}^m(U) \to
\lim \underline{\mathcal{H}}^m_n(U) \to 0
\end{equation}
by Lemma \ref{lemma-RGamma-commutes-with-Rlim}.
\end{remark}

\noindent
The following lemma applies to an inverse system of quasi-coherent
modules with surjective transition maps on an algebraic space or
an algebraic stack.

\begin{lemma}
\label{lemma-inverse-limit-is-derived-limit}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $(\mathcal{F}_n)$ be an
inverse system of $\mathcal{O}$-modules. Let
$\mathcal{B} \subset \Ob(\mathcal{C})$ be a subset. Assume
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are elements
of $\mathcal{B}$,
\item $H^p(U, \mathcal{F}_n) = 0$ for $p > 0$ and $U \in \mathcal{B}$,
\item the inverse system $\mathcal{F}_n(U)$ has vanishing $R^1\lim$
for $U \in \mathcal{B}$.
\end{enumerate}
Then $R\lim \mathcal{F}_n = \lim \mathcal{F}_n$ and we have
$H^p(U, \lim \mathcal{F}_n) = 0$ for $p > 0$ and $U \in \mathcal{B}$.
\end{lemma}

\begin{proof}
Set $K_n = \mathcal{F}_n$ and $K = R\lim \mathcal{F}_n$. Using the notation
of Remark \ref{remark-discuss-derived-limit} and assumption (2) we see that for
$U \in \mathcal{B}$ we have $\underline{\mathcal{H}}_n^m(U) = 0$
when $m \not = 0$ and $\underline{\mathcal{H}}_n^0(U) = \mathcal{F}_n(U)$.
From Equation (\ref{equation-ses-Rlim-over-U}) and assumption (3)
we see that $\underline{\mathcal{H}}^m(U) = 0$
when $m \not = 0$ and equal to $\lim \mathcal{F}_n(U)$
when $m = 0$. Sheafifying using (1) we find that
$\mathcal{H}^m = 0$ when $m \not = 0$ and equal to
$\lim \mathcal{F}_n$ when $m = 0$.
Hence $K = \lim \mathcal{F}_n$.
Since $H^m(U, K) = \underline{\mathcal{H}}^m(U) = 0$ for $m > 0$
(see above) we see that the second assertion holds.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-derived-limit-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $(K_n)$ be an
inverse system in $D(\mathcal{O})$. Let $V \in \Ob(\mathcal{C})$
and $m \in \mathbf{Z}$. Assume there exist an integer $n(V)$
and a cofinal system $\text{Cov}_V$ of coverings of $V$ such that
for $\{V_i \to V\} \in \text{Cov}_V$
\begin{enumerate}
\item $R^1\lim H^{m - 1}(V_i, K_n) = 0$, and
\item $H^m(V_i, K_n) \to H^m(V_i, K_{n(V)})$ is injective
for $n \geq n(V)$.
\end{enumerate}
Then the map on sections $H^m(R\lim K_n)(V) \to H^m(K_{n(V)})(V)$ is injective.
\end{lemma}

\begin{proof}
Let $\gamma \in H^m(R\lim K_n)(V)$ map to zero in
$H^m(K_{n(V)})(V)$. Since $H^m(R\lim K_n)$ is the sheafification of
$U \mapsto H^m(U, R\lim K_n)$ (by Lemma \ref{lemma-sheafification-cohomology})
we can choose $\{V_i \to V\} \in \text{Cov}_V$
and elements $\tilde\gamma_i \in H^m(V_i, R\lim K_n)$ mapping to
$\gamma|_{V_i}$.
Then $\tilde\gamma_i$ maps to $\tilde\gamma_{i, n(V)} \in H^m(V_i, K_{n(V)})$.
Using that $H^m(K_{n(V)})$ is the sheafification of
$U \mapsto H^m(U, K_{n(V)})$
(by Lemma \ref{lemma-sheafification-cohomology} again)
we see that after replacing $\{V_i \to V\}$ by a refinement
we may assume that $\tilde\gamma_{i, n(V)} = 0$ for all $i$.
For this covering we consider the short exact sequences
$$
0 \to
R^1\lim H^{m - 1}(V_i, K_n) \to H^m(V_i, R\lim K_n) \to
\lim H^m(V_i, K_n) \to 0
$$
of Lemma \ref{lemma-RGamma-commutes-with-Rlim}.
By assumption (1) the group on the left is zero and by
assumption (2) the group on the right maps injectively
into $H^m(V_i, K_{n(V)})$. We conclude $\tilde\gamma_i = 0$
and hence $\gamma = 0$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-is-limit-per-object}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $E \in D(\mathcal{O})$.
Let $\mathcal{B} \subset \Ob(\mathcal{C})$ be a subset. Assume
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members
are elements of $\mathcal{B}$, and
\item for every $V \in \mathcal{B}$ there exist a function
$p(V, -) : \mathbf{Z} \to \mathbf{Z}$ and a cofinal system $\text{Cov}_V$
of coverings of $V$ such that
$$
H^p(V_i, H^{m - p}(E)) = 0
$$
for all $\{V_i \to V\} \in \text{Cov}_V$ and all integers $p, m$
satisfying $p > p(V, m)$.
\end{enumerate}
Then the canonical map $E \to R\lim \tau_{\geq -n} E$
is an isomorphism in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
Set $K_n = \tau_{\geq -n}E$ and $K = R\lim K_n$.
The canonical map $E \to K$
comes from the canonical maps $E \to K_n = \tau_{\geq -n}E$.
We have to show that $E \to K$ induces an isomorphism
$H^m(E) \to H^m(K)$ of cohomology sheaves. In the rest of the
proof we fix $m$. If $n \geq -m$, then
the map $E \to \tau_{\geq -n}E = K_n$ induces an isomorphism
$H^m(E) \to H^m(K_n)$.
To finish the proof it suffices to show that for every $V \in \mathcal{B}$
there exists an integer $n(V) \geq -m$ such that the map
$H^m(K)(V) \to H^m(K_{n(V)})(V)$ is injective. Namely, then
the composition
$$
H^m(E)(V) \to H^m(K)(V) \to H^m(K_{n(V)})(V)
$$
is a bijection and the second arrow is injective, hence the
first arrow is bijective. By property (1) this will imply
$H^m(E) \to H^m(K)$ is an isomorphism. Set
$$
n(V) = 1 + \max\{-m, p(V, m - 1) - m, -1 + p(V, m) - m, -2 + p(V, m + 1) - m\}.
$$
so that in any case $n(V) \geq -m$. Claim: the maps
$$
H^{m - 1}(V_i, K_{n + 1}) \to H^{m - 1}(V_i, K_n)
\quad\text{and}\quad
H^m(V_i, K_{n + 1}) \to H^m(V_i, K_n)
$$
are isomorphisms for $n \geq n(V)$ and $\{V_i \to V\} \in \text{Cov}_V$.
The claim implies conditions
(1) and (2) of Lemma \ref{lemma-cohomology-derived-limit-injective}
are satisfied and hence implies the desired injectivity.
Recall (Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle})
that we have distinguished triangles
$$
H^{-n - 1}(E)[n + 1] \to
K_{n + 1} \to K_n \to H^{-n - 1}(E)[n + 2]
$$
Looking at the asssociated long exact cohomology sequence the claim follows if
$$
H^{m + n}(V_i, H^{-n - 1}(E)),\quad
H^{m + n + 1}(V_i, H^{-n - 1}(E)),\quad
H^{m + n + 2}(V_i, H^{-n - 1}(E))
$$
are zero for $n \geq n(V)$ and $\{V_i \to V\} \in \text{Cov}_V$.
This follows from our choice of $n(V)$
and the assumption in the lemma.
\end{proof}

\begin{lemma}
\label{lemma-is-limit-spaltenstein}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $E \in D(\mathcal{O})$.
Let $\mathcal{B} \subset \Ob(\mathcal{C})$ be a subset. Assume
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are
elements of $\mathcal{B}$, and
\item for every $V \in \mathcal{B}$ there exist an integer $d_V \geq 0$ and
a cofinal system $\text{Cov}_V$ of coverings of $V$ such that
$$
H^p(V_i, H^q(E)) = 0 \text{ for }
\{V_i \to V\} \in \text{Cov}_V,\ p > d_V, \text{ and }q < 0
$$
\end{enumerate}
Then the canonical map $E \to R\lim \tau_{\geq -n} E$
is an isomorphism in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-is-limit-per-object}
with $p(V, m) = d_V + \max(0, m)$.
\end{proof}

\begin{lemma}
\label{lemma-is-limit}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $E \in D(\mathcal{O})$.
Assume there exists a function $p(-) : \mathbf{Z} \to \mathbf{Z}$
and a subset $\mathcal{B} \subset \Ob(\mathcal{C})$ such that
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are
elements of $\mathcal{B}$,
\item $H^p(V, H^{m - p}(E)) = 0$ for $p > p(m)$ and $V \in \mathcal{B}$.
\end{enumerate}
Then the canonical map $E \to R\lim \tau_{\geq -n} E$
is an isomorphism in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
Apply Lemma \ref{lemma-is-limit-per-object}
with $p(V, m) = p(m)$ and $\text{Cov}_V$
equal to the set of coverings $\{V_i \to V\}$ with
$V_i \in \mathcal{B}$ for all $i$.
\end{proof}

\begin{lemma}
\label{lemma-is-limit-dimension}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $E \in D(\mathcal{O})$.
Assume there exists an integer $d \geq 0$
and a subset $\mathcal{B} \subset \Ob(\mathcal{C})$ such that
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are
elements of $\mathcal{B}$,
\item $H^p(V, H^q(E)) = 0$ for $p > d$, $q < 0$, and $V \in \mathcal{B}$.
\end{enumerate}
Then the canonical map $E \to R\lim \tau_{\geq -n} E$
is an isomorphism in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
Apply Lemma \ref{lemma-is-limit-spaltenstein}
with $d_V = d$ and $\text{Cov}_V$
equal to the set of coverings $\{V_i \to V\}$ with
$V_i \in \mathcal{B}$ for all $i$.
\end{proof}

\noindent
The lemmas above can be used to compute cohomology
in certain situations.

\begin{lemma}
\label{lemma-cohomology-over-U-trivial}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K$
be an object of $D(\mathcal{O})$.
Let $\mathcal{B} \subset \Ob(\mathcal{C})$ be a subset. Assume
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are
elements of $\mathcal{B}$,
\item $H^p(U, H^q(K)) = 0$ for all $p > 0$, $q \in \mathbf{Z}$, and
$U \in \mathcal{B}$.
\end{enumerate}
Then $H^q(U, K) = H^0(U, H^q(K))$ for $q \in \mathbf{Z}$
and $U \in \mathcal{B}$.
\end{lemma}

\begin{proof}
Observe that $K = R\lim \tau_{\geq -n} K$ by
Lemma \ref{lemma-is-limit-dimension} with $d = 0$.
Let $U \in \mathcal{B}$. By Equation (\ref{equation-ses-Rlim-over-U})
we get a short exact sequence
$$
0 \to R^1\lim H^{q - 1}(U, \tau_{\geq -n}K) \to
H^q(U, K) \to \lim H^q(U, \tau_{\geq -n}K) \to 0
$$
Condition (2) implies
$H^q(U, \tau_{\geq -n} K) = H^0(U, H^q(\tau_{\geq -n} K))$
for all $q$ by using the spectral sequence of
Derived Categories, Lemma \ref{derived-lemma-two-ss-complex-functor}.
The spectral sequence converges because $\tau_{\geq -n}K$ is bounded
below. If $n > -q$ then we have $H^q(\tau_{\geq -n}K) = H^q(K)$.
Thus the systems on the left and the right of the displayed
short exact sequence are eventually constant with values
$H^0(U, H^{q - 1}(K))$ and $H^0(U, H^q(K))$ and the lemma follows.
\end{proof}

\noindent
Here is another case where we can describe the derived limit.

\begin{lemma}
\label{lemma-derived-limit-suitable-system}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $(K_n)$
be an inverse system of objects of $D(\mathcal{O})$.
Let $\mathcal{B} \subset \Ob(\mathcal{C})$ be a subset. Assume
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are
elements of $\mathcal{B}$,
\item for all $U \in \mathcal{B}$ and all $q \in \mathbf{Z}$ we have
\begin{enumerate}
\item $H^p(U, H^q(K_n)) = 0$ for $p > 0$,
\item the inverse system $H^0(U, H^q(K_n))$ has vanishing $R^1\lim$.
\end{enumerate}
\end{enumerate}
Then $H^q(R\lim K_n) = \lim H^q(K_n)$ for $q \in \mathbf{Z}$.
\end{lemma}

\begin{proof}
Set $K = R\lim K_n$. We will use notation as in
Remark \ref{remark-discuss-derived-limit}. Let $U \in \mathcal{B}$.
By Lemma \ref{lemma-cohomology-over-U-trivial} and (2)(a)
we have $H^q(U, K_n) = H^0(U, H^q(K_n))$.
Using that the functor $R\Gamma(U, -)$ commutes with
derived limits we have
$$
H^q(U, K) = H^q(R\lim R\Gamma(U, K_n)) = \lim H^0(U, H^q(K_n))
$$
where the final equality follows from
More on Algebra, Remark \ref{more-algebra-remark-compare-derived-limit}
and assumption (2)(b). Thus $H^q(U, K)$ is the inverse limit
the sections of the sheaves $H^q(K_n)$ over $U$. Since
$\lim H^q(K_n)$ is a sheaf we find using assumption (1) that $H^q(K)$,
which is the sheafification of the presheaf $U \mapsto H^q(U, K)$,
is equal to $\lim H^q(K_n)$. This proves the lemma.
\end{proof}







\section{Producing K-injective resolutions}
\label{section-K-injective}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{F}^\bullet$ be a complex of $\mathcal{O}$-modules.
The category $\textit{Mod}(\mathcal{O})$ has enough injectives, hence
we can use
Derived Categories, Lemma \ref{derived-lemma-special-inverse-system}
produce a diagram
$$
\xymatrix{
\ldots \ar[r] &
\tau_{\geq -2}\mathcal{F}^\bullet \ar[r] \ar[d] &
\tau_{\geq -1}\mathcal{F}^\bullet \ar[d] \\
\ldots \ar[r] & \mathcal{I}_2^\bullet \ar[r] & \mathcal{I}_1^\bullet
}
$$
in the category of complexes of $\mathcal{O}$-modules such that
\begin{enumerate}
\item the vertical arrows are quasi-isomorphisms,
\item $\mathcal{I}_n^\bullet$ is a bounded below complex of injectives,
\item the arrows $\mathcal{I}_{n + 1}^\bullet \to \mathcal{I}_n^\bullet$
are termwise split surjections.
\end{enumerate}
The category of $\mathcal{O}$-modules has limits (they are computed
on the level of presheaves), hence we can form the termwise limit
$\mathcal{I}^\bullet = \lim_n \mathcal{I}_n^\bullet$. By
Derived Categories, Lemmas
\ref{derived-lemma-bounded-below-injectives-K-injective} and
\ref{derived-lemma-limit-K-injectives}
this is a K-injective complex. In general the canonical map
\begin{equation}
\label{equation-into-candidate-K-injective}
\mathcal{F}^\bullet \to \mathcal{I}^\bullet
\end{equation}
may not be a quasi-isomorphism. In the following lemma we describe some
conditions under which it is.

\begin{lemma}
\label{lemma-K-injective}
In the situation described above. Denote
$\mathcal{H}^m = H^m(\mathcal{F}^\bullet)$ the $m$th cohomology sheaf.
Let $\mathcal{B} \subset \Ob(\mathcal{C})$ be a subset.
Let $d \in \mathbf{N}$.
Assume
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are
elements of $\mathcal{B}$,
\item for every $U \in \mathcal{B}$ we have $H^p(U, \mathcal{H}^q) = 0$
for $p > d$ and $q < 0$\footnote{It suffices if
$\forall m$, $\exists p(m)$, $H^p(U. \mathcal{H}^{m - p}) = 0$ for
$p > p(m)$, see Lemma \ref{lemma-is-limit}.}.
\end{enumerate}
Then (\ref{equation-into-candidate-K-injective}) is a quasi-isomorphism.
\end{lemma}

\begin{proof}
By Derived Categories, Lemma \ref{derived-lemma-difficulty-K-injectives}
it suffices to show that the canonical map
$\mathcal{F}^\bullet \to R\lim \tau_{\geq -n} \mathcal{F}^\bullet$
is an isomorphism. This follows from Lemma \ref{lemma-is-limit-dimension}.
\end{proof}

\noindent
Here is a technical lemma about cohomology sheaves of termwise limits of
inverse systems of complexes of modules. We should avoid using this lemma
as much as possible and instead use arguments with derived inverse
limits.

\begin{lemma}
\label{lemma-inverse-limit-complexes}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{F}_n^\bullet)$ be an inverse system of complexes of
$\mathcal{O}$-modules. Let $m \in \mathbf{Z}$. Suppose given
$\mathcal{B} \subset \Ob(\mathcal{C})$ and an integer
$n_0$ such that
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose members are
elements of $\mathcal{B}$,
\item for every $U \in \mathcal{B}$
\begin{enumerate}
\item the systems of abelian groups
$\mathcal{F}_n^{m - 2}(U)$ and $\mathcal{F}_n^{m - 1}(U)$
have vanishing $R^1\lim$ (for example these have the Mittag-Leffler property),
\item the system of abelian groups $H^{m - 1}(\mathcal{F}_n^\bullet(U))$
has vanishing $R^1\lim$ (for example it has the Mittag-Leffler property), and
\item we have
$H^m(\mathcal{F}_n^\bullet(U)) = H^m(\mathcal{F}_{n_0}^\bullet(U))$
for all $n \geq n_0$.
\end{enumerate}
\end{enumerate}
Then the maps $H^m(\mathcal{F}^\bullet) \to \lim H^m(\mathcal{F}_n^\bullet)
\to H^m(\mathcal{F}_{n_0}^\bullet)$ are isomorphisms of sheaves where
$\mathcal{F}^\bullet = \lim \mathcal{F}_n^\bullet$ is the termwise
inverse limit. 
\end{lemma}

\begin{proof}
Let $U \in \mathcal{B}$. Note that
$H^m(\mathcal{F}^\bullet(U))$ is the cohomology of
$$
\lim_n \mathcal{F}_n^{m - 2}(U) \to
\lim_n \mathcal{F}_n^{m - 1}(U) \to
\lim_n \mathcal{F}_n^m(U) \to
\lim_n \mathcal{F}_n^{m + 1}(U)
$$
in the third spot from the left. By assumptions (2)(a) and (2)(b)
we may apply
More on Algebra, Lemma \ref{more-algebra-lemma-apply-Mittag-Leffler-again}
to conclude that
$$
H^m(\mathcal{F}^\bullet(U)) = \lim H^m(\mathcal{F}_n^\bullet(U))
$$
By assumption (2)(c) we conclude
$$
H^m(\mathcal{F}^\bullet(U)) = H^m(\mathcal{F}_n^\bullet(U))
$$
for all $n \geq n_0$. By assumption (1) we conclude that the sheafification of
$U \mapsto H^m(\mathcal{F}^\bullet(U))$ is equal to the sheafification
of $U \mapsto H^m(\mathcal{F}_n^\bullet(U))$ for all $n \geq n_0$.
Thus the inverse system of sheaves $H^m(\mathcal{F}_n^\bullet)$ is
constant for $n \geq n_0$ with value $H^m(\mathcal{F}^\bullet)$ which
proves the lemma.
\end{proof}







\section{Bounded cohomological dimension}
\label{section-bounded}

\noindent
In this section we ask when a functor $Rf_*$ has
bounded cohomological dimension. This is a rather subtle question
when we consider unbounded complexes.

\begin{situation}
\label{situation-olsson-laszlo}
Let $\mathcal{C}$ be a site. Let $\mathcal{O}$ be a sheaf of rings on
$\mathcal{C}$. Let $\mathcal{A} \subset \textit{Mod}(\mathcal{O})$
be a weak Serre subcategory. We assume the following is true:
there exists a subset $\mathcal{B} \subset \Ob(\mathcal{C})$ such that
\begin{enumerate}
\item every object of $\mathcal{C}$ has a covering whose
members are in $\mathcal{B}$, and
\item for every $V \in \mathcal{B}$ there exists an integer $d_V$
and a cofinal system $\text{Cov}_V$ of coverings of $V$ such
that
$$
H^p(V_i, \mathcal{F}) = 0 \text{ for }
\{V_i \to V\} \in \text{Cov}_V,\ p > d_V, \text{ and }
\mathcal{F} \in \Ob(\mathcal{A})
$$
\end{enumerate}
\end{situation}

\begin{lemma}
\label{lemma-olsson-laszlo}
\begin{reference}
This is \cite[Proposition 2.1.4]{six-I} with slightly changed
hypotheses; it is the analogue of \cite[Proposition 3.13]{Spaltenstein}
for sites.
\end{reference}
In Situation \ref{situation-olsson-laszlo} for any
$E \in D_\mathcal{A}(\mathcal{O})$ the canonical map
$E \to R\lim \tau_{\geq -n} E$
is an isomorphism in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
Follows immediately from Lemma \ref{lemma-is-limit-spaltenstein}.
\end{proof}

\begin{lemma}
\label{lemma-olsson-laszlo-modified}
In Situation \ref{situation-olsson-laszlo} let
$(K_n)$ be an inverse system in $D_\mathcal{A}^+(\mathcal{O})$.
Assume that for every $j$ the inverse system $(H^j(K_n))$
in $\mathcal{A}$ is eventually constant with value $\mathcal{H}^j$. Then
$H^j(R\lim K_n) = \mathcal{H}^j$ for all $j$.
\end{lemma}

\begin{proof}
Let $V \in \mathcal{B}$. Let $\{V_i \to V\}$ be in the set
$\text{Cov}_V$ of Situation \ref{situation-olsson-laszlo}.
Because $K_n$ is bounded below there is a spectral sequence
$$
E_2^{p, q} = H^p(V_i, H^q(K_n))
$$
converging to $H^{p + q}(V_i, K_n)$. See
Derived Categories, Lemma \ref{derived-lemma-two-ss-complex-functor}.
Observe that $E_2^{p, q} = 0$
for $p > d_V$ by assumption. Pick $n_0$ such that
$$
\begin{matrix}
\mathcal{H}^{j + 1} & = & H^{j + 1}(K_n), \\
\mathcal{H}^j & = & H^j(K_n), \\
\ldots, \\
\mathcal{H}^{j - d_V - 2} & = & H^{j - d_V - 2}(K_n)
\end{matrix}
$$
for all $n \geq n_0$. Comparing the spectral sequences above
for $K_n$ and $K_{n_0}$, we see that for $n \geq n_0$ the
cohomology groups $H^{j - 1}(V_i, K_n)$ and $H^j(V_i, K_n)$
are independent of $n$. It follows that the map on sections
$H^j(R\lim K_n)(V) \to H^j(K_n)(V)$ is injective for $n$ large
enough (depending on $V$), see
Lemma \ref{lemma-cohomology-derived-limit-injective}.
Since every object of $\mathcal{C}$ can be covered by elements
of $\mathcal{B}$, we conclude that the map
$H^j(R\lim K_n) \to \mathcal{H}^j$ is injective.

\medskip\noindent
Surjectivity is shown in a similar manner. Namely, pick
$U \in \Ob(\mathcal{C})$ and $\gamma \in \mathcal{H}^j(U)$.
We want to lift $\gamma$ to a section of $H^j(R\lim K_n)$
after replacing $U$ by the members of a covering. Hence we may
assume $U = V \in \mathcal{B}$ by property (1) of
Situation \ref{situation-olsson-laszlo}.
Pick $n_0$ such that
$$
\begin{matrix}
\mathcal{H}^{j + 1} & = & H^{j + 1}(K_n), \\
\mathcal{H}^j & = & H^j(K_n), \\
\ldots, \\
\mathcal{H}^{j - d_V - 2} & = & H^{j - d_V - 2}(K_n)
\end{matrix}
$$
for all $n \geq n_0$. Choose an element $\{V_i \to V\}$ of
$\text{Cov}_V$ such that
$\gamma|_{V_i} \in \mathcal{H}^j(V_i) = H^j(K_{n_0})(V_i)$
lifts to an element $\gamma_{n_0, i} \in H^j(V_i, K_{n_0})$.
This is possible because $H^j(K_{n_0})$ is the sheafification
of $U \mapsto H^j(U, K_{n_0})$ by Lemma \ref{lemma-sheafification-cohomology}.
By the discussion in the first paragraph of the proof we have that
$H^{j - 1}(V_i, K_n)$ and $H^j(V_i, K_n)$
are independent of $n \geq n_0$. Hence
$\gamma_{n_0, i}$ lifts to an element
$\gamma_i \in H^j(V_i, R\lim K_n)$ by
Lemma \ref{lemma-RGamma-commutes-with-Rlim}.
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-olsson-laszlo-map-version-one}
\begin{reference}
This is a version of \cite[Lemma 2.1.10]{six-I} with slightly changed
hypotheses.
\end{reference}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi.
Let $\mathcal{A} \subset \textit{Mod}(\mathcal{O})$
and $\mathcal{A}' \subset \textit{Mod}(\mathcal{O}')$
be weak Serre subcategories. Assume there is an integer $N$ such that
\begin{enumerate}
\item $\mathcal{C}, \mathcal{O}, \mathcal{A}$ satisfy the
assumption of Situation \ref{situation-olsson-laszlo},
\item $\mathcal{C}', \mathcal{O}', \mathcal{A}'$ satisfy the
assumption of Situation \ref{situation-olsson-laszlo},
\item $R^pf_*\mathcal{F} \in \Ob(\mathcal{A}')$ for
$p \geq 0$ and $\mathcal{F} \in \Ob(\mathcal{A})$,
\item $R^pf_*\mathcal{F} = 0$ for
$p > N$ and $\mathcal{F} \in \Ob(\mathcal{A})$,
\end{enumerate}
Then for $K$ in $D_\mathcal{A}(\mathcal{O})$ we have
\begin{enumerate}
\item[(a)] $Rf_*K$ is in $D_{\mathcal{A}'}(\mathcal{O}')$,
\item[(b)] the map
$H^j(Rf_*K) \to H^j(Rf_*(\tau_{\geq -n}K))$ is an isomorphism
for $j \geq N - n$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-olsson-laszlo} we have $K = R\lim \tau_{\geq -n}K$.
By Lemma \ref{lemma-Rf-commutes-with-Rlim}
we have $Rf_*K = R\lim Rf_*\tau_{\geq -n}K$.
The complexes $Rf_*\tau_{\geq -n}K$ are bounded below.
The spectral sequence
$$
E_2^{p, q} = R^pf_*H^q(\tau_{\geq -n}K)
$$
converging to $H^{p + q}(Rf_*\tau_{\geq -n}K)$
(Derived Categories, Lemma \ref{derived-lemma-two-ss-complex-functor})
and assumption (3)
show that $Rf_*\tau_{\geq -n}K$ lies in $D^+_{\mathcal{A}'}(\mathcal{O}')$,
see Homology, Lemma \ref{homology-lemma-biregular-ss-converges}.
Observe that for $m \geq n$ the map
$$
Rf_*(\tau_{\geq -m}K) \longrightarrow Rf_*(\tau_{\geq -n}K)
$$
induces an isomorphism on cohomology sheaves in degrees $j \geq -n + N$
by the spectral sequences above. Hence we may apply
Lemma \ref{lemma-olsson-laszlo-modified} to conclude.
\end{proof}

\noindent
It turns out that we sometimes need a variant of the lemma above
where the assumptions are sligthly different.

\begin{situation}
\label{situation-olsson-laszlo-prime}
Let
$f : (\mathcal{C}, \mathcal{O}) \to (\mathcal{C}', \mathcal{O}')$
be a morphism of ringed sites. Let $u : \mathcal{C}' \to \mathcal{C}$
be the corresponding continuous functor of sites.
Let $\mathcal{A} \subset \textit{Mod}(\mathcal{O})$
be a weak Serre subcategory. We assume the following is true:
there exists a subset $\mathcal{B}' \subset \Ob(\mathcal{C}')$ such that
\begin{enumerate}
\item every object of $\mathcal{C}'$ has a covering whose
members are in $\mathcal{B}'$, and
\item for every $V' \in \mathcal{B}'$ there exists an integer $d_{V'}$
and a cofinal system $\text{Cov}_{V'}$ of coverings of $V'$ such
that
$$
H^p(u(V'_i), \mathcal{F}) = 0 \text{ for }
\{V'_i \to V'\} \in \text{Cov}_{V'},\ p > d_{V'}, \text{ and }
\mathcal{F} \in \Ob(\mathcal{A})
$$
\end{enumerate}
\end{situation}

\begin{lemma}
\label{lemma-olsson-laszlo-map-version-two}
\begin{reference}
This is a version of \cite[Lemma 2.1.10]{six-I} with slightly changed
hypotheses.
\end{reference}
Let $f : (\mathcal{C}, \mathcal{O}) \to (\mathcal{C}', \mathcal{O}')$
be a morphism of ringed sites.
assume moreover there is an integer $N$ such that
\begin{enumerate}
\item $\mathcal{C}, \mathcal{O}, \mathcal{A}$ satisfy the
assumption of Situation \ref{situation-olsson-laszlo},
\item $f : (\mathcal{C}, \mathcal{O}) \to (\mathcal{C}', \mathcal{O}')$
and $\mathcal{A}$ satisfy the assumption of
Situation \ref{situation-olsson-laszlo-prime},
\item $R^pf_*\mathcal{F} = 0$ for
$p > N$ and $\mathcal{F} \in \Ob(\mathcal{A})$,
\end{enumerate}
Then for $K$ in $D_\mathcal{A}(\mathcal{O})$ the map
$H^j(Rf_*K) \to H^j(Rf_*(\tau_{\geq -n}K))$ is an isomorphism
for $j \geq N - n$.
\end{lemma}

\begin{proof}
Let $K$ be in $D_\mathcal{A}(\mathcal{O})$.
By Lemma \ref{lemma-olsson-laszlo} we have $K = R\lim \tau_{\geq -n}K$.
By Lemma \ref{lemma-Rf-commutes-with-Rlim}
we have $Rf_*K = R\lim Rf_*(\tau_{\geq -n}K)$.
Let $V' \in \mathcal{B}'$ and let $\{V'_i \to V'\}$ be an element
of $\text{Cov}_{V'}$. Then we consider
$$
H^j(V'_i, Rf_*K) = H^j(u(V'_i), K)
\quad\text{and}\quad
H^j(V'_i, Rf_*(\tau_{\geq -n}K)) = H^j(u(V'_i), \tau_{\geq -n}K)
$$
The assumption in Situation \ref{situation-olsson-laszlo-prime}
implies that the last group is independent of $n$ for $n$ large enough
depending on $j$ and $d_{V'}$. Some details omitted.
We apply this for $j$ and $j - 1$ and via
Lemma \ref{lemma-RGamma-commutes-with-Rlim} this gives that
$$
H^j(V'_i, Rf_*K) = \lim H^j(V'_i, Rf_*(\tau_{\geq -n} K))
$$
and the system on the right is constant for $n$ larger than
a constant depending only on $d_{V'}$ and $j$.
Thus Lemma \ref{lemma-cohomology-derived-limit-injective}
implies that
$$
H^j(Rf_*K)(V') \longrightarrow
\left(\lim H^j(Rf_*(\tau_{\geq -n}K))\right)(V')
$$
is injective. Since the elements $V' \in \mathcal{B}'$ cover
every object of $\mathcal{C}'$ we conclude that the map
$H^j(Rf_*K) \to \lim H^j(Rf_*(\tau_{\geq -n}K))$ is injective.
The spectral sequence
$$
E_2^{p, q} = R^pf_*H^q(\tau_{\geq -n}K)
$$
converging to $H^{p + q}(Rf_*(\tau_{\geq -n}K))$
(Derived Categories, Lemma \ref{derived-lemma-two-ss-complex-functor})
and assumption (3) show that
$H^j(Rf_*(\tau_{\geq -n}K))$ is constant for $n \geq N - j$.
Hence $H^j(Rf_*K) \to H^j(Rf_*(\tau_{\geq -n}K))$ is injective
for $j \geq N - n$.

\medskip\noindent
Thus we proved the lemma with ``isomorphism'' in the last line of
the lemma replaced by ``injective''. However, now choose $j$ and $n$
with $j \geq N - n$. Then consider the distinguished triangle
$$
\tau_{\leq -n - 1}K \to K \to \tau_{\geq -n}K \to (\tau_{\leq -n - 1}K)[1]
$$
See Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}.
Since $\tau_{\geq -n}\tau_{\leq -n -1}K = 0$, the
injectivity already proven for $\tau_{-n - 1}K$ implies
$$
0 = H^j(Rf_*(\tau_{\leq -n - 1}K)) =
H^{j + 1}(Rf_*(\tau_{\leq -n - 1}K)) =
H^{j + 2}(Rf_*(\tau_{\leq -n - 1}K)) = \ldots
$$
By the long exact cohomology sequence associated to the distinguished
triangle
$$
Rf_*(\tau_{\leq -n - 1}K) \to Rf_*K \to Rf_*(\tau_{\geq -n}K) \to
Rf_*(\tau_{\leq -n - 1}K)[1]
$$
this implies that $H^j(Rf_*K) \to H^j(Rf_*(\tau_{\geq -n}K))$
is an isomorphism.
\end{proof}








\section{Mayer-Vietoris}
\label{section-mayer-vietoris}

\noindent
For the usual statement and proof of Mayer-Vietoris, please
see Cohomology, Section \ref{cohomology-section-mayer-vietoris}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Consider a
commutative diagram
$$
\xymatrix{
E \ar[d] \ar[r] & Y \ar[d] \\
Z \ar[r] & X
}
$$
in the category $\mathcal{C}$. In this situation, given an object
$K$ of $D(\mathcal{O})$ we get what looks like the
beginning of a distinguished triangle
$$
R\Gamma(X, K) \to
R\Gamma(Z, K) \oplus
R\Gamma(Y, K) \to
R\Gamma(E, K)
$$
In the following lemma we make this more precise.

\begin{lemma}
\label{lemma-c-square}
In the situation above, choose a K-injective complex $\mathcal{I}^\bullet$
of $\mathcal{O}$-modules representing $K$. Using $-1$ times the canonical map
for one of the four arrows we get maps of complexes
$$
\mathcal{I}^\bullet(X) \xrightarrow{\alpha}
\mathcal{I}^\bullet(Z) \oplus
\mathcal{I}^\bullet(Y) \xrightarrow{\beta}
\mathcal{I}^\bullet(E)
$$
with $\beta \circ \alpha = 0$. Thus a canonical map
$$
c^K_{X, Z, Y, E} :
\mathcal{I}^\bullet(X)
\longrightarrow
C(\beta)^\bullet[-1]
$$
This map is canonical in the sense that a different choice
of K-injective complex representing $K$ determines an isomorphic
arrow in the derived category of abelian groups. If $c^K_{X, Z, Y, E}$
is an isomorphism, then using its inverse we obtain a canonical
distinguished triangle
$$
R\Gamma(X, K) \to
R\Gamma(Z, K) \oplus
R\Gamma(Y, K) \to
R\Gamma(E, K) \to
R\Gamma(X, K)[1]
$$
All of these constructions are functorial in $K$.
\end{lemma}

\begin{proof}
This lemma proves itself. For example, if $\mathcal{J}^\bullet$
is a second K-injective complex representing $K$, then
we can choose a quasi-isomorphism
$\mathcal{I}^\bullet \to \mathcal{J}^\bullet$
which determines quasi-isomorphisms between all the complexes
in sight. Details omitted. For the construction of cones
and the relationship with distinguished triangles see
Derived Categories, Sections \ref{derived-section-cones} and
\ref{derived-section-homotopy-triangulated}.
\end{proof}

\begin{lemma}
\label{lemma-two-out-of-three-blow-up-square}
In the situation above, let $K_1 \to K_2 \to K_3 \to K_1[1]$ be a distinguished
triangle in $D(\mathcal{O})$.
If $c^{K_i}_{X, Z, Y, E}$ is a quasi-isomorphism for
two $i$ out of $\{1, 2, 3\}$, then it is a quasi-isomorphism
for the third $i$.
\end{lemma}

\begin{proof}
By rotating the triangle we may assume $c^{K_1}_{X, Z, Y, E}$ and
$c^{K_2}_{X, Z, Y, E}$ are quasi-isomorphisms. Choose a map
$f : \mathcal{I}^\bullet_1 \to \mathcal{I}^\bullet_2$ of
K-injective complexes of $\mathcal{O}$-modules representing $K_1 \to K_2$.
Then $K_3$ is represented by the K-injective complex
$C(f)^\bullet$, see
Derived Categories, Lemma \ref{derived-lemma-triangle-K-injective}.
Then the morphism $c^{K_3}_{X, Z, Y, E}$ is an isomorphism
as it is the third leg in a map of distinguished triangles
in $K(\textit{Ab})$ whose other two legs are quasi-isomorphisms.
Some details omitted; use
Derived Categories, Lemma \ref{derived-lemma-third-isomorphism-triangle}.
\end{proof}

\noindent
Let us give a criterion for when this does produce
a distinguished triangle.

\begin{lemma}
\label{lemma-square-triangle}
In the situation above assume
\begin{enumerate}
\item $h_X^\# = h_Y^\# \amalg_{h_E^\#} h_Z^\#$, and
\item $h_E^\# \to h_Y^\#$ is injective.
\end{enumerate}
Then the construction of Lemma \ref{lemma-c-square}
produces a distinguished triangle
$$
R\Gamma(X, K) \to
R\Gamma(Z, K) \oplus
R\Gamma(Y, K) \to
R\Gamma(E, K) \to R\Gamma(X, K)[1]
$$
functorial for $K$ in $D(\mathcal{C})$.
\end{lemma}

\begin{proof}
We can represent $K$ by a K-injective complex whose terms are injective
abelian sheaves, see Section \ref{section-unbounded}.
Thus it suffices to show: if $\mathcal{I}$ is an injective abelian
sheaf, then
$$
0 \to \mathcal{I}(X) \to
\mathcal{I}(Z) \oplus \mathcal{I}(Y) \to
\mathcal{I}(E) \to 0
$$
is a short exact sequence. The first arrow is injective
because by condition (1) the map $h_Y \amalg h_Z \to h_X$
becomes surjective after sheafification, which means that
$\{Y \to X, Z \to X\}$ can be refined by a covering of $X$.
The last arrow is surjective because $\mathcal{I}(Y) \to \mathcal{I}(E)$
is surjective. Namely, we have
$\mathcal{I}(E) = \Hom(\mathbf{Z}_E^\#, \mathcal{I})$,
$\mathcal{I}(Y) = \Hom(\mathbf{Z}_Y^\#, \mathcal{I})$,
the map $\mathbf{Z}_E^\# \to \mathbf{Z}_Y^\#$ is injective
by (2), and $\mathcal{I}$ is an injective abelian sheaf.
Please compare with Modules on Sites, Section
\ref{sites-modules-section-free-abelian-sheaf}.
Finally, suppose we have $s \in \mathcal{I}(Y)$ and
$t \in \mathcal{F}(Z)$ mapping to the same element of
$\mathcal{I}(E)$. Then $s$ and $t$ define a map
$$
s \amalg t : h_Y^\# \amalg h_Z^\# \longrightarrow \mathcal{I}
$$
which by assumption factors through $h_Y^\# \amalg_{h_E^\#} h_Z^\#$.
Thus by assumption (1) we obtain a unique map
$h_X^\# \to \mathcal{I}$ which corresponds to an element
of $\mathcal{I}(X)$ restricting to $s$ on $Y$ and $t$ on $Z$.
\end{proof}

\begin{lemma}
\label{lemma-square-triangle-general}
Let $\mathcal{C}$ be a site. Consider a commutative diagram
$$
\xymatrix{
\mathcal{D} \ar[r] \ar[d] & \mathcal{F} \ar[d] \\
\mathcal{E} \ar[r] & \mathcal{G}
}
$$
of presheaves of sets on $\mathcal{C}$ and assume that
\begin{enumerate}
\item $\mathcal{G}^\# =
\mathcal{E}^\# \amalg_{\mathcal{D}^\#} \mathcal{F}^\#$, and
\item $\mathcal{D}^\# \to \mathcal{F}^\#$ is injective.
\end{enumerate}
Then there is a canonical distinguished triangle
$$
R\Gamma(\mathcal{G}, K) \to
R\Gamma(\mathcal{E}, K) \oplus
R\Gamma(\mathcal{F}, K) \to
R\Gamma(\mathcal{D}, K) \to
R\Gamma(\mathcal{G}, K)[1]
$$
functorial in $K \in D(\mathcal{C})$ where $R\Gamma(\mathcal{G}, -)$
is the cohomology discussed in Section \ref{section-limp}.
\end{lemma}

\begin{proof}
Since sheafification is exact and since
$R\Gamma(\mathcal{G}, -) = R\Gamma(\mathcal{G}^\#, -)$
we may assume $\mathcal{D}, \mathcal{E}, \mathcal{F}, \mathcal{G}$
are sheaves of sets. Moreover, the cohomology
$R\Gamma(\mathcal{G}, -)$ only depends on the topos,
not on the underlying site. Hence by
Sites, Lemma \ref{sites-lemma-topos-good-site}
we may replace $\mathcal{C}$ by a ``larger'' site
with a subcanonical topology such that $\mathcal{G} = h_X$,
$\mathcal{F} = h_Y$,
$\mathcal{E} = h_Z$, and
$\mathcal{D} = h_E$
for some objects $X, Y, Z, E$ of $\mathcal{C}$.
In this case the result follows from
Lemma \ref{lemma-square-triangle}.
\end{proof}







\section{Comparing two topologies}
\label{section-compare}

\noindent
Let $\mathcal{C}$ be a category. Let
$\text{Cov}(\mathcal{C}) \supset \text{Cov}'(\mathcal{C})$
be two ways to endow $\mathcal{C}$ with the structure of a site.
Denote $\tau$ the topology corresponding to $\text{Cov}(\mathcal{C})$
and $\tau'$ the topology corresponding to $\text{Cov}'(\mathcal{C})$.
Then the identity functor on $\mathcal{C}$ defines a morphism
of sites
$$
\epsilon : \mathcal{C}_\tau \longrightarrow \mathcal{C}_{\tau'}
$$
where $\epsilon_*$ is the identity functor on underlying presheaves and
where $\epsilon^{-1}$ is the $\tau$-sheafification of a $\tau'$-sheaf.
See Sites, Examples \ref{sites-example-finer-topology} and
\ref{sites-example-finer-topology-bis}.
In the situation above we have the following
\begin{enumerate}
\item $\epsilon_* : \Sh(\mathcal{C}_\tau) \to \Sh(\mathcal{C}_{\tau'})$
is fully faithful and $\epsilon^{-1} \circ \epsilon_* = \text{id}$,
\item $\epsilon_* : \textit{Ab}(\mathcal{C}_\tau) \to
\textit{Ab}(\mathcal{C}_{\tau'})$
is fully faithful and $\epsilon^{-1} \circ \epsilon_* = \text{id}$,
\item $R\epsilon_* : D(\mathcal{C}_\tau) \to D(\mathcal{C}_{\tau'})$
is fully faithful and $\epsilon^{-1} \circ R\epsilon_* = \text{id}$,
\item if $\mathcal{O}$ is a sheaf of rings for the $\tau$-topology,
then $\mathcal{O}$ is also a sheaf for the $\tau'$-topology
and $\epsilon$ becomes a flat morphism of ringed sites
$$
\epsilon :
(\mathcal{C}_\tau, \mathcal{O}_\tau)
\longrightarrow
(\mathcal{C}_{\tau'}, \mathcal{O}_{\tau'})
$$
\item $\epsilon_* : \textit{Mod}(\mathcal{O}_\tau) \to
\textit{Mod}(\mathcal{O}_{\tau'})$ is
fully faithful and $\epsilon^* \circ \epsilon_* = \text{id}$
\item $R\epsilon_* : D(\mathcal{O}_\tau) \to D(\mathcal{O}_{\tau'})$
is fully faithful and $\epsilon^* \circ R\epsilon_* = \text{id}$.
\end{enumerate}
Here are some explanations.

\medskip\noindent
Ad (1). Let $\mathcal{F}$ be a sheaf of sets in the $\tau$-topology.
Then $\epsilon_*\mathcal{F}$ is just $\mathcal{F}$ viewed as a sheaf
in the $\tau'$-topology. Applying $\epsilon^{-1}$ means taking the
$\tau$-sheafification of $\mathcal{F}$, which doesn't do anything
as $\mathcal{F}$ is already a $\tau$-sheaf. Thus
$\epsilon^{-1}(\epsilon_*\mathcal{F})) = \mathcal{F}$.
The fully faithfulness follows by Categories, Lemma
\ref{categories-lemma-adjoint-fully-faithful}.

\medskip\noindent
Ad (2). This is a consequence of (1) since pullback and pushforward
of abelian sheaves is the same as doing those operations on the underlying
sheaves of sets.

\medskip\noindent
Ad (3). Let $K$ be an object of $D(\mathcal{C}_\tau)$.
To compute $R\epsilon_*K$ we choose a K-injective
complex $\mathcal{I}^\bullet$ representing $K$
and we set $R\epsilon_*K = \epsilon_*\mathcal{I}^\bullet$.
Since $\epsilon^{-1} : D(\mathcal{C}_{\tau'}) \to D(\mathcal{C}_\tau)$
is computed on an object $L$ by applying the exact functor $\epsilon^{-1}$
to any complex of abelian sheaves representing $L$, we find that
$\epsilon^{-1}R\epsilon_*K$ is represented by
$\epsilon^{-1}\epsilon_*\mathcal{I}^\bullet$. By
Part (1) we have
$\mathcal{I}^\bullet = \epsilon^{-1}\epsilon_*\mathcal{I}^\bullet$.
In other words, we have $\epsilon^{-1} \circ R\epsilon_* = \text{id}$
and we conclude as before.

\medskip\noindent
Ad (4). Observe that $\epsilon^{-1}\mathcal{O}_{\tau'} = \mathcal{O}_\tau$, see
discussion in part (1). Hence $\epsilon$ is a flat morphism of ringed
sites, see
Modules on Sites, Definition \ref{sites-modules-definition-flat-morphism}.
Not only that, it is moreover clear that $\epsilon^* = \epsilon^{-1}$
on $\mathcal{O}_{\tau'}$-modules (the pullback as a module has the same
underlying abelian sheaf as the pullback of the underlying abelian sheaf).

\medskip\noindent
Ad (5). This is clear from (2) and what we said in (4).

\medskip\noindent
Ad (6). This is analogous to (3). We omit the details.












\section{Formalities on cohomological descent}
\label{section-formal-cohomological-descent}

\noindent
In this section we discuss only to what extent a morphism
of ringed topoi determines an embedding from the derived
category downstairs to the derived category upstairs.
Here is a typical result.

\begin{lemma}
\label{lemma-downstairs}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Consider the full subcategory $D' \subset D(\mathcal{O}_\mathcal{D})$
consisting of objects $K$ such that
$$
K \longrightarrow Rf_*Lf^*K
$$
is an isomorphism. Then $D'$ is a saturated triangulated strictly full
subcategory of $D(\mathcal{O}_\mathcal{D})$ and the functor
$Lf^* : D' \to D(\mathcal{O}_\mathcal{C})$ is fully faithful.
\end{lemma}

\begin{proof}
See Derived Categories, Definition \ref{derived-definition-saturated}
for the definition of saturated in this setting. See
Derived Categories, Lemma \ref{derived-lemma-triangulated-subcategory}
for a discussion of triangulated subcategories.
The canonical map of the lemma is the unit of the adjoint
pair of functors $(Lf^*, Rf_*)$, see Lemma \ref{lemma-adjoint}.
Having said this the proof that $D'$ is a saturated triangulated subcategory
is omitted; it follows formally from the fact that
$Lf^*$ and $Rf_*$ are exact functors of triangulated categories.
The final part follows formally from
fact that $Lf^*$ and $Rf_*$ are adjoint; compare with
Categories, Lemma \ref{categories-lemma-adjoint-fully-faithful}.
\end{proof}

\begin{lemma}
\label{lemma-upstairs}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Consider the full subcategory $D' \subset D(\mathcal{O}_\mathcal{C})$
consisting of objects $K$ such that
$$
Lf^*Rf_*K \longrightarrow K
$$
is an isomorphism. Then $D'$ is a saturated triangulated strictly full
subcategory of $D(\mathcal{O}_\mathcal{C})$ and the functor
$Rf_* : D' \to D(\mathcal{O}_\mathcal{D})$ is fully faithful.
\end{lemma}

\begin{proof}
See Derived Categories, Definition \ref{derived-definition-saturated}
for the definition of saturated in this setting. See
Derived Categories, Lemma \ref{derived-lemma-triangulated-subcategory}
for a discussion of triangulated subcategories.
The canonical map of the lemma is the counit of the adjoint
pair of functors $(Lf^*, Rf_*)$, see Lemma \ref{lemma-adjoint}.
Having said this the proof that $D'$ is a saturated triangulated subcategory
is omitted; it follows formally from the fact that
$Lf^*$ and $Rf_*$ are exact functors of triangulated categories.
The final part follows formally from
fact that $Lf^*$ and $Rf_*$ are adjoint; compare with
Categories, Lemma \ref{categories-lemma-adjoint-fully-faithful}.
\end{proof}

\begin{lemma}
\label{lemma-bounded-in-image-upstairs}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $K$ be an object of $D(\mathcal{O}_\mathcal{C})$. Assume
\begin{enumerate}
\item $f$ is flat,
\item $K$ is bounded below,
\item $f^*Rf_*H^q(K) \to H^q(K)$ is an isomorphism.
\end{enumerate}
Then $f^*Rf_*K \to K$ is an isomorphism.
\end{lemma}

\begin{proof}
Observe that $f^*Rf_*K \to K$ is an isomorphism if and only
if it is an isomorphism on cohomology sheaves $H^j$. Observe that
$H^j(f^*Rf_*K) = f^*H^j(Rf_*K) = f^*H^j(Rf_*\tau_{\leq j}K) =
H^j(f^*Rf_*\tau_{\leq j}K)$.
Hence we may assume that $K$ is bounded. Then property (3)
tells us the cohomology sheaves are in the triangulated
subcategory $D' \subset D(\mathcal{O}_\mathcal{C})$ of
Lemma \ref{lemma-upstairs}. Hence $K$ is in it too.
\end{proof}

\begin{lemma}
\label{lemma-bounded-in-image-downstairs}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $K$ be an object of $D(\mathcal{O}_\mathcal{D})$. Assume
\begin{enumerate}
\item $f$ is flat,
\item $K$ is bounded below,
\item $H^q(K) \to Rf_*f^*H^q(K)$ is an isomorphism.
\end{enumerate}
Then $K \to Rf_*f^*K$ is an isomorphism.
\end{lemma}

\begin{proof}
Observe that $K \to Rf_*f^*K$ is an isomorphism if and only
if it is an isomorphism on cohomology sheaves $H^j$. Observe that
$H^j(Rf_*f^*K) = H^j(Rf_*\tau_{\leq j}f^*K) = H^j(Rf_*f^*\tau_{\leq j}K)$.
Hence we may assume that $K$ is bounded. Then property (3)
tells us the cohomology sheaves are in the triangulated
subcategory $D' \subset D(\mathcal{O}_\mathcal{D})$ of
Lemma \ref{lemma-downstairs}. Hence $K$ is in it too.
\end{proof}

\begin{lemma}
\label{lemma-equivalence-bounded}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi.
Let $\mathcal{A} \subset \textit{Mod}(\mathcal{O})$
and $\mathcal{A}' \subset \textit{Mod}(\mathcal{O}')$
be weak Serre subcategories. Assume
\begin{enumerate}
\item $f$ is flat,
\item $f^*$ induces an equivalence of categories
$\mathcal{A}' \to \mathcal{A}$,
\item $\mathcal{F}' \to Rf_*f^*\mathcal{F}'$ is an isomorphism
for $\mathcal{F}' \in \Ob(\mathcal{A}')$.
\end{enumerate}
Then
$f^* : D_{\mathcal{A}'}^+(\mathcal{O}') \to D_\mathcal{A}^+(\mathcal{O})$
is an equivalence of categories with quasi-inverse given by
$Rf_* : D_\mathcal{A}^+(\mathcal{O}) \to D_{\mathcal{A}'}^+(\mathcal{O}')$.
\end{lemma}

\begin{proof}
By assumptions (2) and (3) and
Lemmas \ref{lemma-bounded-in-image-downstairs} and \ref{lemma-downstairs}
we see that
$f^* : D_{\mathcal{A}'}^+(\mathcal{O}') \to D_\mathcal{A}^+(\mathcal{O})$
is fully faithful.
Let $\mathcal{F} \in \Ob(\mathcal{A})$. Then we can write
$\mathcal{F} = f^*\mathcal{F}'$. Then
$Rf_*\mathcal{F} = Rf_* f^*\mathcal{F}' = \mathcal{F}'$.
In particular, we have $R^pf_*\mathcal{F} = 0$ for $p > 0$
and $f_*\mathcal{F} \in \Ob(\mathcal{A}')$.
Thus for any $K \in D^+_\mathcal{A}(\mathcal{O})$ we see,
using the spectral sequence $E_2^{p, q} = R^pf_*H^q(K)$
converging to $R^{p + q}f_*K$,
that $Rf_*K$ is in $D^+_{\mathcal{A}'}(\mathcal{O}')$.
Of course, it also follows from
Lemmas \ref{lemma-bounded-in-image-upstairs} and \ref{lemma-upstairs}
that $Rf_* : D_\mathcal{A}^+(\mathcal{O}) \to D_{\mathcal{A}'}^+(\mathcal{O}')$
is fully faithful. Since $f^*$ and $Rf_*$ are adjoint
we then get the result of the lemma, for example by
Categories, Lemma \ref{categories-lemma-adjoint-fully-faithful}.
\end{proof}

\begin{lemma}
\label{lemma-equivalence-unbounded-one}
\begin{reference}
This is analogous to \cite[Theorem 2.2.3]{six-I}.
\end{reference}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi.
Let $\mathcal{A} \subset \textit{Mod}(\mathcal{O})$
and $\mathcal{A}' \subset \textit{Mod}(\mathcal{O}')$
be weak Serre subcategories. Assume
\begin{enumerate}
\item $f$ is flat,
\item $f^*$ induces an equivalence of categories
$\mathcal{A}' \to \mathcal{A}$,
\item $\mathcal{F}' \to Rf_*f^*\mathcal{F}'$ is an isomorphism
for $\mathcal{F}' \in \Ob(\mathcal{A}')$,
\item $\mathcal{C}, \mathcal{O}, \mathcal{A}$ satisfy the
assumption of Situation \ref{situation-olsson-laszlo},
\item $\mathcal{C}', \mathcal{O}', \mathcal{A}'$ satisfy the
assumption of Situation \ref{situation-olsson-laszlo}.
\end{enumerate}
Then $f^* : D_{\mathcal{A}'}(\mathcal{O}') \to D_\mathcal{A}(\mathcal{O})$
is an equivalence of categories with quasi-inverse given by
$Rf_* : D_\mathcal{A}(\mathcal{O}) \to D_{\mathcal{A}'}(\mathcal{O}')$.
\end{lemma}

\begin{proof}
Since $f^*$ is exact, it is clear that $f^*$ defines a functor
$f^* : D_{\mathcal{A}'}(\mathcal{O}') \to D_\mathcal{A}(\mathcal{O})$
as in the statement of the lemma and that moreover this
functor commutes with the truncation functors $\tau_{\geq -n}$.
We already know that $f^*$ and $Rf_*$ are quasi-inverse
equivalence on the corresponding bounded below categories,
see Lemma \ref{lemma-equivalence-bounded}.
By Lemma \ref{lemma-olsson-laszlo-map-version-one}
with $N = 0$ we see that $Rf_*$ indeed defines a functor
$Rf_* : D_\mathcal{A}(\mathcal{O}) \to D_{\mathcal{A}'}(\mathcal{O}')$
and that moreover this functor commutes with
the truncation functors $\tau_{\geq -n}$.
Thus for $K$ in $D_\mathcal{A}(\mathcal{O})$ the map
$f^*Rf_*K \to K$ is an isomorphism as this is true
on trunctions.
Similarly, for $K'$ in $D_{\mathcal{A}'}(\mathcal{O}')$ the map
$K' \to Rf_*f^*K'$ is an isomorphism as this is true
on trunctions.
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-equivalence-unbounded-two}
\begin{reference}
This is analogous to \cite[Theorem 2.2.3]{six-I}.
\end{reference}
Let $f : (\mathcal{C}, \mathcal{O}) \to (\mathcal{C}', \mathcal{O}')$
be a morphism of ringed sites.
Let $\mathcal{A} \subset \textit{Mod}(\mathcal{O})$
and $\mathcal{A}' \subset \textit{Mod}(\mathcal{O}')$
be weak Serre subcategories. Assume
\begin{enumerate}
\item $f$ is flat,
\item $f^*$ induces an equivalence of categories
$\mathcal{A}' \to \mathcal{A}$,
\item $\mathcal{F}' \to Rf_*f^*\mathcal{F}'$ is an isomorphism
for $\mathcal{F}' \in \Ob(\mathcal{A}')$,
\item $\mathcal{C}, \mathcal{O}, \mathcal{A}$ satisfy the
assumption of Situation \ref{situation-olsson-laszlo},
\item $f : (\mathcal{C}, \mathcal{O}) \to (\mathcal{C}', \mathcal{O}')$
and $\mathcal{A}$ satisfy the assumption of
Situation \ref{situation-olsson-laszlo-prime}.
\end{enumerate}
Then $f^* : D_{\mathcal{A}'}(\mathcal{O}') \to D_\mathcal{A}(\mathcal{O})$
is an equivalence of categories with quasi-inverse given by
$Rf_* : D_\mathcal{A}(\mathcal{O}) \to D_{\mathcal{A}'}(\mathcal{O}')$.
\end{lemma}

\begin{proof}
The proof of this lemma is exactly the same as the proof
of Lemma \ref{lemma-equivalence-unbounded-one}
except the reference to Lemma \ref{lemma-olsson-laszlo-map-version-one}
is replaced by a reference to
Lemma \ref{lemma-olsson-laszlo-map-version-two}.
\end{proof}








\section{Comparing two topologies, II}
\label{section-compare-II}

\noindent
Let $\mathcal{C}$ be a category. Let
$\text{Cov}(\mathcal{C}) \supset \text{Cov}'(\mathcal{C})$
be two ways to endow $\mathcal{C}$ with the structure of a site.
Denote $\tau$ the topology corresponding to $\text{Cov}(\mathcal{C})$
and $\tau'$ the topology corresponding to $\text{Cov}'(\mathcal{C})$.
Then the identity functor on $\mathcal{C}$ defines a morphism
of sites
$$
\epsilon : \mathcal{C}_\tau \longrightarrow \mathcal{C}_{\tau'}
$$
where $\epsilon_*$ is the identity functor on underlying presheaves and
where $\epsilon^{-1}$ is the $\tau$-sheafification of a $\tau'$-sheaf
(hence clearly exact). Let $\mathcal{O}$ be a sheaf of rings for the
$\tau$-topology. Then $\mathcal{O}$ is also a sheaf for the $\tau'$-topology
and $\epsilon$ becomes a morphism of ringed sites
$$
\epsilon :
(\mathcal{C}_\tau, \mathcal{O}_\tau)
\longrightarrow
(\mathcal{C}_{\tau'}, \mathcal{O}_{\tau'})
$$
For more discussion, see Section \ref{section-compare}.

\begin{lemma}
\label{lemma-compare-topologies-derived-adequate-modules}
With $\epsilon : (\mathcal{C}_\tau, \mathcal{O}_\tau) \to
(\mathcal{C}_{\tau'}, \mathcal{O}_{\tau'})$ as above.
Let $\mathcal{B} \subset \Ob(\mathcal{C})$ be a subset.
Let $\mathcal{A} \subset \textit{PMod}(\mathcal{O})$
be a full subcategory. Assume
\begin{enumerate}
\item every object of $\mathcal{A}$ is a sheaf for the $\tau$-topology,
\item $\mathcal{A}$ is a weak Serre subcategory of
$\textit{Mod}(\mathcal{O}_\tau)$,
\item every object of $\mathcal{C}$ has a $\tau'$-covering whose
members are elements of $\mathcal{B}$, and
\item for every $U \in \mathcal{B}$ we have $H^p_\tau(U, \mathcal{F}) = 0$,
$p > 0$ for all $\mathcal{F} \in \mathcal{A}$.
\end{enumerate}
Then $\mathcal{A}$ is a weak Serre subcategory of
$\textit{Mod}(\mathcal{O}_{\tau'})$ and there is an equivalence
of triangulated categories
$D_\mathcal{A}(\mathcal{O}_\tau) = D_\mathcal{A}(\mathcal{O}_{\tau'})$
given by $\epsilon^*$ and $R\epsilon_*$.
\end{lemma}

\begin{proof}
Since $\epsilon^{-1}\mathcal{O}_{\tau'} = \mathcal{O}_\tau$
we see that $\epsilon$ is a flat morphism of ringed sites
and that in fact $\epsilon^{-1} = \epsilon^*$ on sheaves
of modules. By property (1) we can think of every object of
$\mathcal{A}$ as a sheaf of $\mathcal{O}_\tau$-modules
and as a sheaf of $\mathcal{O}_{\tau'}$-modules.
In other words, we have fully faithful inclusion functors
$$
\mathcal{A} \to \textit{Mod}(\mathcal{O}_\tau) \to
\textit{Mod}(\mathcal{O}_{\tau'})
$$
To avoid confusion we will denote
$\mathcal{A}' \subset \textit{Mod}(\mathcal{O}_{\tau'})$
the image of $\mathcal{A}$. Then it is clear that
$\epsilon_* : \mathcal{A} \to \mathcal{A}'$ and
$\epsilon^* : \mathcal{A}' \to \mathcal{A}$ are
quasi-inverse equivalences (see discussion preceding
the lemma and use that objects of $\mathcal{A}'$ are
sheaves in the $\tau$ topology).

\medskip\noindent
Conditions (3) and (4) imply that $R^p\epsilon_*\mathcal{F} = 0$
for $p > 0$ and $\mathcal{F} \in \Ob(\mathcal{A})$.
This is true because $R^p\epsilon_*$ is the sheaf associated
to the presheave $U \mapsto H^p_\tau(U, \mathcal{F})$, see
Lemma \ref{lemma-higher-direct-images}.
Thus any exact complex in $\mathcal{A}$ (which is the same thing
as an exact complex in $\textit{Mod}(\mathcal{O}_\tau)$
whose terms are in $\mathcal{A}$, see
Homology, Lemma \ref{homology-lemma-characterize-weak-serre-subcategory})
remains exact upon applying the functor $\epsilon_*$.

\medskip\noindent
Consider an exact sequence
$$
\mathcal{F}'_0 \to \mathcal{F}'_1 \to
\mathcal{F}'_2 \to \mathcal{F}'_3 \to
\mathcal{F}'_4
$$
in $\textit{Mod}(\mathcal{O}_{\tau'})$ with
$\mathcal{F}'_0, \mathcal{F}'_1, \mathcal{F}'_3, \mathcal{F}'_4$ in
$\mathcal{A}'$. Apply the exact functor $\epsilon^*$ to get
an exact sequence
$$
\epsilon^*\mathcal{F}'_0 \to \epsilon^*\mathcal{F}'_1 \to
\epsilon^*\mathcal{F}'_2 \to \epsilon^*\mathcal{F}'_3 \to
\epsilon^*\mathcal{F}'_4
$$
in $\textit{Mod}(\mathcal{O}_\tau)$. Since $\mathcal{A}$ is
a weak Serre subcategory and since
$\epsilon^*\mathcal{F}'_0, \epsilon^*\mathcal{F}'_1,
\epsilon^*\mathcal{F}'_3, \epsilon^*\mathcal{F}'_4$ are in
$\mathcal{A}$, we conclude that $\epsilon^*\mathcal{F}_2$
is in $\mathcal{A}$ by
Homology, Definition \ref{homology-definition-serre-subcategory}.
Consider the map of sequences
$$
\xymatrix{
\mathcal{F}'_0 \ar[r] \ar[d] &
\mathcal{F}'_1 \ar[r] \ar[d] &
\mathcal{F}'_2 \ar[r] \ar[d] &
\mathcal{F}'_3 \ar[r] \ar[d] &
\mathcal{F}'_4 \ar[d] \\
\epsilon_*\epsilon^*\mathcal{F}'_0 \ar[r] &
\epsilon_*\epsilon^*\mathcal{F}'_1 \ar[r] &
\epsilon_*\epsilon^*\mathcal{F}'_2 \ar[r] &
\epsilon_*\epsilon^*\mathcal{F}'_3 \ar[r] &
\epsilon_*\epsilon^*\mathcal{F}'_4
}
$$
The lower row is exact by the discussion in the preceding
paragraph. The vertical arrows with index $0$, $1$, $3$, $4$
are isomorphisms by the discussion in the first paragraph.
By the $5$ lemma (Homology, Lemma \ref{homology-lemma-five-lemma})
we find that $\mathcal{F}'_2 \cong \epsilon_*\epsilon^*\mathcal{F}'_2$
and hence $\mathcal{F}'_2$ is in $\mathcal{A}'$.
In this way we see that $\mathcal{A}'$ is a weak Serre subcategory
of $\textit{Mod}(\mathcal{O}_{\tau'})$, see
Homology, Definition \ref{homology-definition-serre-subcategory}.

\medskip\noindent
At this point it makes sense to talk about the
derived categories $D_\mathcal{A}(\mathcal{O}_\tau)$ and
$D_{\mathcal{A}'}(\mathcal{O}_{\tau'})$, see
Derived Categories, Section \ref{derived-section-triangulated-sub}.
To finish the proof we show that conditions
(1) -- (5) of Lemma \ref{lemma-equivalence-unbounded-two} apply.
We have already seen (1), (2), (3) above.
Note that since every object has a $\tau'$-covering
by objects of $\mathcal{B}$, a fortiori every object has
a $\tau$-covering by objects of $\mathcal{B}$. Hence
condition (4) of Lemma \ref{lemma-equivalence-unbounded-two} is satisfied.
Similarly, condition (5) is satisfied as well.
\end{proof}

\begin{lemma}
\label{lemma-descent-squares}
With $\epsilon : (\mathcal{C}_\tau, \mathcal{O}_\tau) \to
(\mathcal{C}_{\tau'}, \mathcal{O}_{\tau'})$ as above.
Let $A$ be a set and for $\alpha \in A$ let
$$
\xymatrix{
E_\alpha \ar[d] \ar[r] & Y_\alpha \ar[d] \\
Z_\alpha \ar[r] & X_\alpha
}
$$
be a commutative diagram in the category $\mathcal{C}$. Assume that
\begin{enumerate}
\item a $\tau'$-sheaf $\mathcal{F}'$ is a $\tau$-sheaf if
$\mathcal{F}'(X_\alpha) =
\mathcal{F}'(Z_\alpha) \times_{\mathcal{F}'(E_\alpha)} 
\mathcal{F}'(Y_\alpha)$ for all $\alpha$,
\item for $K'$ in $D(\mathcal{O}_{\tau'})$ in the essential image
of $R\epsilon_*$ the maps $c^{K'}_{X_\alpha, Z_\alpha, Y_\alpha, E_\alpha}$
of Lemma \ref{lemma-c-square}
are isomorphisms for all $\alpha$.
\end{enumerate}
Then $K' \in D^+(\mathcal{O}_{\tau'})$ is in
the essential image of $R\epsilon_*$ if and only if
the maps $c^{K'}_{X_\alpha, Z_\alpha, Y_\alpha, E_\alpha}$
are isomorphisms for all $\alpha$.
\end{lemma}

\begin{proof}
The ``only if'' direction is implied by assumption (2).
On the other hand, if $K'$ has a unique nonzero cohomology sheaf,
then the ``if'' direction follows from assumption (1).
In general we will use an induction argument to prove the
``if'' direction. Let us say an object $K'$ of $D^+(\mathcal{O}_{\tau'})$
satisfies (P) if the maps $c^{K'}_{X_\alpha, Z_\alpha, Y_\alpha, E_\alpha}$
are isomorphisms for all $\alpha \in A$.

\medskip\noindent
Namely, let $K'$ be an object of $D^+(\mathcal{O}_{\tau'})$
satisfying (P). Choose a distinguished triangle
$$
K' \to R\epsilon_*\epsilon^{-1}K' \to M' \to K'[1]
$$
in $D^+(\mathcal{O}_{\tau'})$ where the first arrow is the adjuntion map.
By (2) and Lemma \ref{lemma-two-out-of-three-blow-up-square}
we see that $M'$ has (P). On the other hand, applying
$\epsilon^{-1}$ and using that $\epsilon^{-1}R\epsilon_* = \text{id}$
by Section \ref{section-compare} we find that $\epsilon^{-1}M' = 0$.
In the next paragraph we will show $M' = 0$ which finishes the proof.

\medskip\noindent
Let $K'$ be an object of $D^+(\mathcal{O}_{\tau'})$
satisfying (P) with $\epsilon^{-1}K' = 0$. We will show $K' = 0$.
Namely, given $n \in \mathbf{Z}$ such that $H^i(K') = 0$
for $i < n$ we will show that $H^n(K') = 0$.
For $\alpha \in A$ we have a distinguished triangle
$$
R\Gamma_{\tau'}(X_\alpha, K') \to
R\Gamma_{\tau'}(Z_\alpha, K') \oplus
R\Gamma_{\tau'}(Y_\alpha, K') \to
R\Gamma_{\tau'}(E_\alpha, K') \to
R\Gamma_{\tau'}(X_\alpha, K')[1]
$$
by Lemma \ref{lemma-c-square}. Taking cohomology in degree $n$ and using
the assumed vanishing of cohomology sheaves of $K'$ we obtain an exact
sequence
$$
0 \to
H^n_{\tau'}(X_\alpha, K') \to
H^n_{\tau'}(Z_\alpha, K') \oplus
H^n_{\tau'}(Y_\alpha, K') \to
H^n_{\tau'}(E_\alpha, K')
$$
which is the same as the exact sequence
$$
0 \to
\Gamma(X_\alpha, H^n(K')) \to
\Gamma(Z_\alpha, H^n(K')) \oplus
\Gamma(Y_\alpha, H^n(K')) \to
\Gamma(E_\alpha, H^n(K'))
$$
We conclude that $H^n(K')$ is a a $\tau$-sheaf by assumption (1).
However, since the $\tau$-sheafification
$\epsilon^{-1}H^n(K') = H^n(\epsilon^{-1}K')$ is $0$ as
$\epsilon^{-1}K' = 0$
we conclude that $H^n(K') = 0$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-descent-squares-helper}
With $\epsilon : (\mathcal{C}_\tau, \mathcal{O}_\tau) \to
(\mathcal{C}_{\tau'}, \mathcal{O}_{\tau'})$ as above. Let
$$
\xymatrix{
E \ar[d] \ar[r] & Y \ar[d] \\
Z \ar[r] & X
}
$$
be a commutative diagram in the category $\mathcal{C}$ such that
\begin{enumerate}
\item $h_X^\# = h_Y^\# \amalg_{h_E^\#} h_Z^\#$, and
\item $h_E^\# \to h_Y^\#$ is injective
\end{enumerate}
where ${}^\#$ denotes $\tau$-sheafification. Then for
$K' \in D(\mathcal{O}_{\tau'})$ in the essential image of
$R\epsilon_*$ the map $c^{K'}_{X, Z, Y, E}$ of Lemma \ref{lemma-c-square}
(using the $\tau'$-topology) is an isomorphism.
\end{lemma}

\begin{proof}
This helper lemma is an almost immediate consequence of
Lemma \ref{lemma-square-triangle}
and we strongly urge the reader skip the proof.
Say $K' = R\epsilon_*K$. Choose a K-injective complex of
$\mathcal{O}_\tau$-modules $\mathcal{J}^\bullet$ representing $K$.
Then $\epsilon_*\mathcal{J}^\bullet$ is a K-injective complex of
$\mathcal{O}_{\tau'}$-modules representing $K'$, see
Lemma \ref{lemma-K-injective-flat}. Next,
$$
0 \to
\mathcal{J}^\bullet(X) \xrightarrow{\alpha}
\mathcal{J}^\bullet(Z) \oplus
\mathcal{J}^\bullet(Y) \xrightarrow{\beta}
\mathcal{J}^\bullet(E)
\to 0
$$
is a short exact sequence of complexes of abelian groups, see
Lemma \ref{lemma-square-triangle} and its proof.
Since this is the same as the sequence of complexes of abelian
groups which is used to define $c^{K'}_{X, Z, Y, E}$, we conclude.
\end{proof}







\section{Comparing cohomology}
\label{section-compare-general}

\noindent
We develop some general theory which will help us compare
cohomology in different topologies. Given
$\mathcal{C}$, $\tau$, and $\tau'$ as in Section \ref{section-compare}
and a morphism $f : X \to Y$ in $\mathcal{C}$ we obtain a commutative
diagram of morphisms of topoi
\begin{equation}
\label{equation-commutative-epsilon}
\vcenter{
\xymatrix{
\Sh(\mathcal{C}_\tau/X) \ar[r]_{f_\tau} \ar[d]_{\epsilon_X} &
\Sh(\mathcal{C}_\tau/Y) \ar[d]^{\epsilon_Y} \\
\Sh(\mathcal{C}_{\tau'}/X) \ar[r]^{f_{\tau'}} &
\Sh(\mathcal{C}_{\tau'}/X)
}
}
\end{equation}
Here the morphism $\epsilon_X$, resp.\ $\epsilon_Y$ is the comparison
morphism of Section \ref{section-compare} for the
category $\mathcal{C}/X$ endowed with the two
topologies $\tau$ and $\tau'$. The morphisms $f_\tau$ and $f_{\tau'}$
are ``relocalization'' morphisms (Sites, Lemma \ref{sites-lemma-relocalize}).
The commutativity of the diagram is a special case of
Sites, Lemma \ref{sites-lemma-localize-morphism}
(applied with $\mathcal{C} = \mathcal{C}_\tau/Y$,
$\mathcal{D} = \mathcal{C}_{\tau'}/Y$,
$u = \text{id}$, $U = X$, and $V = X$). We also get
$\epsilon_{X, *} \circ f_\tau^{-1} = f_{\tau'}^{-1} \circ \epsilon_{Y, *}$
either from the lemma or because it is obvious.

\begin{situation}
\label{situation-compare}
With $\mathcal{C}$, $\tau$, and $\tau'$ as in Section \ref{section-compare}.
Assume we are given a subset $\mathcal{P} \subset \text{Arrows}(\mathcal{C})$
and for every object $X$ of $\mathcal{C}$ we are given a weak Serre subcategory
$\mathcal{A}'_X \subset \textit{Ab}(\mathcal{C}_{\tau'}/X)$.
We make the following assumption:
\begin{enumerate}
\item
\label{item-base-change-P}
given $f : X \to Y$ in $\mathcal{P}$ and $Y' \to Y$ general,
then $X \times_Y Y'$ exists and $X \times_Y Y' \to Y'$ is in $\mathcal{P}$,
\item
\label{item-restriction-A}
$f_{\tau'}^{-1}$ sends $\mathcal{A}'_Y$ into $\mathcal{A}'_X$
for any morphism $f : X \to Y$ of $\mathcal{C}$,
\item
\label{item-A-sheaf}
given $X$ in $\mathcal{C}$ and $\mathcal{F}'$ in $\mathcal{A}'_X$, then
$\mathcal{F}'$ satisfies the sheaf condition for $\tau$-coverings, i.e.,
$\mathcal{F}' = \epsilon_{X, *}\epsilon_X^{-1}\mathcal{F}'$,
\item
\label{item-A-and-P}
if $f : X \to Y$ in $\mathcal{P}$ and
$\mathcal{F}' \in \Ob(\mathcal{A}'_X)$, then
$R^if_{\tau', *}\mathcal{F}' \in \Ob(\mathcal{A}'_Y)$
for $i \geq 0$.
\item
\label{item-refine-tau-by-P}
if $\{U_i \to U\}_{i \in I}$ is a $\tau$-covering, then there exist
\begin{enumerate}
\item a $\tau'$-covering $\{V_j \to U\}_{j \in J}$,
\item a $\tau$-covering $\{f_j : W_j \to V_j\}$ consisting
of a single $f_j \in \mathcal{P}$, and
\item a $\tau'$-covering $\{W_{jk} \to W_j\}_{k \in K_j}$
\end{enumerate}
such that $\{W_{jk} \to U\}_{j \in J, k \in K_j}$ is a refinement of
$\{U_i \to U\}_{i \in I}$.
\end{enumerate}
\end{situation}

\begin{lemma}
\label{lemma-A}
In Situation \ref{situation-compare} for $X$ in $\mathcal{C}$
denote $\mathcal{A}_X$
the objects of $\textit{Ab}(\mathcal{C}_\tau/X)$ of the form
$\epsilon_X^{-1}\mathcal{F}'$ with $\mathcal{F}'$ in $\mathcal{A}'_X$.
Then
\begin{enumerate}
\item for $\mathcal{F}$ in $\textit{Ab}(\mathcal{C}_\tau/X)$
we have $\mathcal{F} \in \mathcal{A}_X \Leftrightarrow
\epsilon_{X, *}\mathcal{F} \in \mathcal{A}'_X$, and
\item $f_\tau^{-1}$ sends $\mathcal{A}_Y$ into $\mathcal{A}_X$
for any morphism $f : X \to Y$ of $\mathcal{C}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from (\ref{item-A-sheaf}) and part (2)
follows from (\ref{item-restriction-A}) and
the commutativity of (\ref{equation-commutative-epsilon}) which gives
$\epsilon_X^{-1} \circ f_{\tau'}^{-1} = f_\tau^{-1} \circ \epsilon_Y^{-1}$.
\end{proof}

\noindent
Our next goal is to prove Lemmas \ref{lemma-compare-cohomology-general} and
\ref{lemma-cohomological-descent-general}. We will do this by an induction
argument using the following induction hypothesis.

\medskip\noindent
$(V_n)$ For $X$ in $\mathcal{C}$ and $\mathcal{F}$ in $\mathcal{A}_X$
we have $R^i\epsilon_{X, *}\mathcal{F} = 0$ for $1 \leq i \leq n$.

\begin{lemma}
\label{lemma-V-implies-C-general}
In Situation \ref{situation-compare} assume $(V_n)$ holds.
For $f : X \to Y$ in $\mathcal{P}$ and $\mathcal{F}$ in $\mathcal{A}_X$
we have $R^if_{\tau', *}\epsilon_{X, *}\mathcal{F} =
\epsilon_{Y, *}R^if_{\tau, *}\mathcal{F}$ for $i \leq n$.
\end{lemma}

\begin{proof}
We will use the commutative diagram (\ref{equation-commutative-epsilon})
without further mention. In particular have
$$
Rf_{\tau', *}R\epsilon_{X, *}\mathcal{F} =
R\epsilon_{Y, *}Rf_{\tau, *}\mathcal{F}
$$
Assumption $(V_n)$ tells us that
$\epsilon_{X, *}\mathcal{F} \to R\epsilon_{X, *}\mathcal{F}$
is an isomorphism in degrees $\leq n$. Hence
$Rf_{\tau', *}\epsilon_{X, *}\mathcal{F} \to
Rf_{\tau', *}R\epsilon_{X, *}\mathcal{F}$ is an isomorphism
in degrees $\leq n$. We conclude that
$$
R^if_{\tau', *}\epsilon_{X, *}\mathcal{F} \to
H^i(R\epsilon_{Y, *}Rf_{\tau, *}\mathcal{F})
$$
is an isomorphism for $i \leq n$. We will prove the lemma by looking
at the second page of the spectral sequence of
Lemma \ref{lemma-relative-Leray}
for $R\epsilon_{Y, *}Rf_{\tau, *}\mathcal{F}$. Here is a picture:
$$
\begin{matrix}
\ldots &
\ldots &
\ldots &
\ldots \\
\epsilon_{Y, *}R^2f_{\tau, *}\mathcal{F} &
R^1\epsilon_{Y, *}R^2f_{\tau, *}\mathcal{F} &
R^2\epsilon_{Y, *}R^2f_{\tau, *}\mathcal{F} &
\ldots \\
\epsilon_{Y, *}R^1f_{\tau, *}\mathcal{F} &
R^1\epsilon_{Y, *}R^1f_{\tau, *}\mathcal{F} &
R^2\epsilon_{Y, *}R^1f_{\tau, *}\mathcal{F} &
\ldots \\
\epsilon_{Y, *}f_{\tau, *}\mathcal{F} &
R^1\epsilon_{Y, *}f_{\tau, *}\mathcal{F} &
R^2\epsilon_{Y, *}f_{\tau, *}\mathcal{F} &
\ldots
\end{matrix}
$$
Let $(C_m)$ be the hypothesis:  $R^if_{\tau', *}\epsilon_{X, *}\mathcal{F} =
\epsilon_{Y, *}R^if_{\tau, *}\mathcal{F}$ for $i \leq m$. Observe that
$(C_0)$ holds. We will show that $(C_{m - 1}) \Rightarrow (C_m)$ for $m < n$.
Namely, if $(C_{m - 1})$ holds, then for
$n \geq p > 0$ and $q \leq m - 1$ we have
\begin{align*}
R^p\epsilon_{Y, *}R^qf_{\tau, *}\mathcal{F}
& =
R^p\epsilon_{Y, *}
\epsilon_Y^{-1} \epsilon_{Y, *} R^qf_{\tau, *}\mathcal{F} \\
& =
R^p\epsilon_{Y, *}
\epsilon_Y^{-1}R^qf_{\tau', *}\epsilon_{X, *}\mathcal{F} = 0
\end{align*}
First equality as $\epsilon_Y^{-1}\epsilon_{Y, *} = \text{id}$,
the second by $(C_{m - 1})$, and the final by
by $(V_n)$ because $\epsilon_Y^{-1}R^qf_{\tau', *}\epsilon_{X, *}\mathcal{F}$
is in $\mathcal{A}_Y$ by (\ref{item-A-and-P}).
Looking at the spectral sequence we see that
$E_2^{0, m} = \epsilon_{Y, *}R^mf_{\tau, *}\mathcal{F}$
is the only nonzero term $E_2^{p, q}$ with $p + q = m$.
Recall that $\text{d}_r^{p, q} : E_r^{p, q} \to E_r^{p + r, q - r + 1}$.
Hence there are no nonzero differentials $\text{d}_r^{p, q}$, $r \geq 2$
either emanating or entering this spot. We conclude that
$H^m(R\epsilon_{Y, *}Rf_{\tau, *}\mathcal{F}) =
\epsilon_{Y, *}R^mf_{\tau, *}\mathcal{F}$ which implies
$(C_m)$ by the discussion above.

\medskip\noindent
Finally, assume $(C_{n - 1})$. The same analysis shows that
$E_2^{0, n} = \epsilon_{Y, *}R^nf_{\tau, *}\mathcal{F}$
is the only nonzero term $E_2^{p, q}$ with $p + q = n$.
We do still have no nonzero differentials entering
this spot, but there can be a nonzero differential
emanating it. Namely, the map
$d_{n + 1}^{0, n} : \epsilon_{Y, *}R^nf_{\tau, *}\mathcal{F} \to
R^{n + 1}\epsilon_{Y, *}f_{\tau, *}\mathcal{F}$.
We conclude that there is an exact sequence
$$
0 \to R^nf_{\tau', *}\epsilon_{X, *}\mathcal{F} \to 
\epsilon_{Y, *}R^nf_{\tau, *}\mathcal{F} \to
R^{n + 1}\epsilon_{Y, *}f_{\tau, *}\mathcal{F}
$$
By (\ref{item-A-and-P}) and (\ref{item-A-sheaf}) the sheaf
$R^nf_{\tau', *}\epsilon_{X, *}\mathcal{F}$
satisfies the sheaf property for $\tau$-coverings
as does $\epsilon_{Y, *}R^nf_{\tau, *}\mathcal{F}$
(use the description of $\epsilon_*$ in Section \ref{section-compare}).
However, the $\tau$-sheafification of the $\tau'$-sheaf
$R^{n + 1}\epsilon_{Y, *}f_{\tau, *}\mathcal{F}$
is zero (by locality of cohomology; use
Lemmas \ref{lemma-kill-cohomology-class-on-covering} and
\ref{lemma-higher-direct-images}).
Thus $R^nf_{\tau', *}\epsilon_{X, *}\mathcal{F} \to 
\epsilon_{Y, *}R^nf_{\tau, *}\mathcal{F}$
has to be an isomorphism and the proof is complete.
\end{proof}

\noindent
If $E'$, resp.\ $E$ is an object of
$D(\mathcal{C}_{\tau'}/X)$, resp.\ $D(\mathcal{C}_\tau/X)$
then we will write
$H^n_{\tau'}(U, E')$, resp.\ $H^n_\tau(U, E)$
for the cohomology of $E'$, resp.\ $E$
over an object $U$ of $\mathcal{C}/X$.

\begin{lemma}
\label{lemma-V-implies-cohomology-general}
In Situation \ref{situation-compare} if $(V_n)$ holds, then
for $X$ in $\mathcal{C}$ and $L \in D(\mathcal{C}_{\tau'}/X)$
with $H^i(L) = 0$ for $i < 0$ and $H^i(L)$ in $\mathcal{A}'_X$
for $0 \leq i \leq n$ we have
$H^n_{\tau'}(X, L) = H^n_\tau(X, \epsilon_X^{-1}L)$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-Leray-unbounded} we have
$H^n_\tau(X, \epsilon_X^{-1}L) =
H^n_{\tau'}(X, R\epsilon_{X, *}\epsilon_X^{-1}L)$.
There is a spectral sequence
$$
E_2^{p, q} = R^p\epsilon_{X, *}\epsilon_X^{-1}H^q(L)
$$
converging to $H^{p + q}(R\epsilon_{X, *}\epsilon_X^{-1}L)$.
By $(V_n)$ we have the vanishing of $E_2^{p, q}$ for
$0 < p \leq n$ and $0 \leq q \leq n$. Thus
$E_2^{0, q} = \epsilon_{X, *}\epsilon_X^{-1}H^q(L) = H^q(L)$
are the only nonzero terms $E_2^{p, q}$ with $p + q \leq n$.
It follows that the map
$$
L \longrightarrow R\epsilon_{X, *}\epsilon_X^{-1}L
$$
is an isomorphism in degrees $\leq n$ (small detail omitted).
Hence we find that
$H^i_{\tau'}(X, L) = H^i_{\tau'}(X, R\epsilon_{X, *}\epsilon_X^{-1}L)$
for $i \leq n$. Thus the lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-V-implies-cohomology-extra-general}
In Situation \ref{situation-compare} if $(V_n)$ holds, then for
$X$ in $\mathcal{C}$ and $\mathcal{F}$ in $\mathcal{A}_X$ the map
$H^{n + 1}_{\tau'}(X, \epsilon_{X, *}\mathcal{F}) \to
H^{n + 1}_\tau(X, \mathcal{F})$
is injective with image those classes which become trivial on
a $\tau'$-covering of $X$.
\end{lemma}

\begin{proof}
Recall that $\epsilon_X^{-1}\epsilon_{X, *}\mathcal{F} = \mathcal{F}$
hence the map is given by pulling back cohomology classes
by $\epsilon_X$. The Leray spectral sequence (Lemma \ref{lemma-Leray})
$$
E_2^{p, q} = H^p_{\tau'}(X, R^q\epsilon_{X, *}\mathcal{F})
\Rightarrow
H^{p + q}_\tau(X, \mathcal{F})
$$
combined with the assumed vanishing gives an exact sequence
$$
0 \to
H^{n + 1}_{\tau'}(X, \epsilon_{X, *}\mathcal{F}) \to
H^{n + 1}_\tau(X, \mathcal{F}) \to
H^0_{\tau'}(X, R^{n + 1}\epsilon_{X, *}\mathcal{F})
$$
This is a restatement of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-make-class-zero-general}
In Situation \ref{situation-compare} let $f : X \to Y$
be in $\mathcal{P}$ such that $\{X \to Y\}$ is a $\tau$-covering.
Let $\mathcal{F}'$ be in $\mathcal{A}'_Y$. If $n \geq 0$ and
$$
\theta \in
\text{Equalizer}\left(
\xymatrix{
H^{n + 1}_{\tau'}(X, \mathcal{F}')
\ar@<1ex>[r] \ar@<-1ex>[r] &
H^{n + 1}_{\tau'}(X \times_Y X, \mathcal{F}')
}
\right)
$$
then there exists a $\tau'$-covering $\{Y_i \to Y\}$
such that $\theta$ restricts to zero in
$H^{n + 1}_{\tau'}(Y_i \times_Y X, \mathcal{F}')$.
\end{lemma}

\begin{proof}
Observe that $X \times_Y X$ exists by (\ref{item-base-change-P}).
For $Z$ in $\mathcal{C}/Y$ denote $\mathcal{F}'|_Z$
the restriction of $\mathcal{F}'$ to $\mathcal{C}_{\tau'}/Z$.
Recall that $H^{n + 1}_{\tau'}(X, \mathcal{F}') =
H^{n + 1}(\mathcal{C}_{\tau'}/X, \mathcal{F}'|_X)$, see
Lemma \ref{lemma-cohomology-of-open}.
The lemma asserts that the
image $\overline{\theta} \in H^0(Y, R^{n + 1}f_{\tau', *}\mathcal{F}'|_X)$
of $\theta$ is zero. Consider the cartesian diagram
$$
\xymatrix{
X \times_Y X \ar[d]_{\text{pr}_1} \ar[r]_{\text{pr}_2} &
X \ar[d]^f \\
X \ar[r]^f & Y
}
$$
By trivial base change (Lemma \ref{lemma-localize-cartesian-square})
we have
$$
f_{\tau'}^{-1}R^{n + 1}f_{\tau', *}(\mathcal{F}'|_X) =
R^{n + 1}\text{pr}_{1, \tau', *}(\mathcal{F}'|_{X \times_Y X})
$$
If $\text{pr}_1^{-1}\theta = \text{pr}_2^{-1}\theta$,
then the section $f_{\tau'}^{-1}\overline{\theta}$ of
$f_{\tau'}^{-1}R^{n + 1}f_{\tau', *}(\mathcal{F}'|_X)$ is zero,
because it is clear that $\text{pr}_1^{-1}\theta$ maps to the zero element in
$H^0(X, R^{n + 1}\text{pr}_{1, \tau', *}(\mathcal{F}'|_{X \times_Y X}))$.
By (\ref{item-restriction-A}) we have $\mathcal{F}'|_X$ in $\mathcal{A}'_X$.
Thus $\mathcal{G}' = R^{n + 1}f_{\tau', *}(\mathcal{F}'|_X)$
is an object of $\mathcal{A}'_Y$ by (\ref{item-A-and-P}).
Thus $\mathcal{G}'$ satisfies the sheaf property for
$\tau$-coverings by (\ref{item-A-sheaf}).
Since $\{X \to Y\}$ is a $\tau$-covering we conclude
that restriction $\mathcal{G}'(Y) \to \mathcal{G}'(X)$ is injective.
It follows that $\overline{\theta}$ is zero.
\end{proof}

\begin{lemma}
\label{lemma-induction-step-V-C-general}
In Situation \ref{situation-compare} we have $(V_n) \Rightarrow (V_{n + 1})$.
\end{lemma}

\begin{proof}
Let $X$ in $\mathcal{C}$ and $\mathcal{F}$ in $\mathcal{A}_X$.
Let $\xi \in H^{n + 1}_\tau(U, \mathcal{F})$ for some $U/X$.
We have to show that $\xi$ restricts to zero on the members of
a $\tau'$-covering of $U$. See
Lemma \ref{lemma-higher-direct-images}.
It follows from this that we may
replace $U$ by the members of a $\tau'$-covering of $U$.

\medskip\noindent
By locality of cohomology
(Lemma \ref{lemma-kill-cohomology-class-on-covering})
we can choose a $\tau$-covering $\{U_i \to U\}$
such that $\xi$ restricts to zero on $U_i$.
Choose $\{V_j \to V\}$, $\{f_j : W_j \to V_j\}$, and
$\{W_{jk} \to W_j\}$ as in (\ref{item-refine-tau-by-P}).
After replacing both $U$ by $V_j$
and $\mathcal{F}$ by its restriction to
$\mathcal{C}_\tau/V_j$, which is allowed by
(\ref{item-base-change-P}), we reduce to the
case discussed in the next paragraph.

\medskip\noindent
Here $f : X \to Y$ is an element of $\mathcal{P}$
such that $\{X \to Y\}$ is a $\tau$-covering,
$\mathcal{F}$ is an object of $\mathcal{A}_Y$, and
$\xi \in H^{n + 1}_\tau(Y, \mathcal{F})$ is such that
there exists a $\tau'$-covering $\{X_i \to X\}_{i \in I}$
such that $\xi$ restricts to zero on $X_i$ for all $i \in I$.
Problem: show that $\xi$ restricts to zero on a $\tau'$-covering of $Y$.

\medskip\noindent
By Lemma \ref{lemma-V-implies-cohomology-extra-general} there exists a
unique $\tau'$-cohomology class
$\theta \in H^{n + 1}_{\tau'}(X, \epsilon_{X, *}\mathcal{F})$
whose image is $\xi|_X$.
Since $\xi|_X$ pulls back to the same class on $X \times_Y X$
via the two projections, we find that the same is true for $\theta$
(by uniqueness).
By Lemma \ref{lemma-make-class-zero-general}
we see that after replacing $Y$ by the members of a $\tau'$-covering,
we may assume that $\theta = 0$.
Consequently, we may assume that $\xi|_X$ is zero.

\medskip\noindent
Let $f : X \to Y$ be an element of $\mathcal{P}$
such that $\{X \to Y\}$ is a $\tau$-covering,
$\mathcal{F}$ is an object of $\mathcal{A}_Y$, and
$\xi \in H^{n + 1}_\tau(Y, \mathcal{F})$
maps to zero in $H^{n + 1}_\tau(X, \mathcal{F})$.
Problem: show that $\xi$ restricts to zero on a $\tau'$-covering of $Y$.

\medskip\noindent
The assumptions tell us $\xi$ maps to zero under the map
$$
\mathcal{F} \longrightarrow Rf_{\tau, *}f_\tau^{-1}\mathcal{F}
$$
Use Lemma \ref{lemma-Leray-unbounded}.
A simple argument using the distinguished triangle of truncations
(Derived Categories, Remark
\ref{derived-remark-truncation-distinguished-triangle}) shows that
$\xi$ maps to zero under the map
$$
\mathcal{F} \longrightarrow \tau_{\leq n}Rf_{\tau, *}f_\tau^{-1}\mathcal{F}
$$
We will compare this with the map $\epsilon_{Y, *}\mathcal{F} \to K$
where
$$
K = \tau_{\leq n}Rf_{\tau', *}f_{\tau'}^{-1}\epsilon_{Y, *}\mathcal{F} =
\tau_{\leq n}Rf_{\tau', *}\epsilon_{X, *}f_{\tau}^{-1}\mathcal{F}
$$
The equality
$\epsilon_{X, *} f_\tau^{-1} = f_{\tau'}^{-1} \epsilon_{Y, *}$
is a property of (\ref{equation-commutative-epsilon}). Consider the map
$$
Rf_{\tau', *}\epsilon_{X, *}f_{\tau}^{-1}\mathcal{F} \longrightarrow
Rf_{\tau', *}R\epsilon_{X, *}f_{\tau}^{-1}\mathcal{F} =
R\epsilon_{Y, *}Rf_{\tau, *}f_\tau^{-1}\mathcal{F}
$$
used in the proof of Lemma \ref{lemma-V-implies-C-general}
which induces by adjunction a map
$$
\epsilon_Y^{-1} Rf_{\tau', *}\epsilon_{X, *}f_{\tau}^{-1}\mathcal{F} \to
Rf_{\tau, *}f_\tau^{-1}\mathcal{F}
$$
Taking trunctions we find a map
$$
\epsilon_Y^{-1}K
\longrightarrow
\tau_{\leq n}Rf_{\tau, *}f_\tau^{-1}\mathcal{F}
$$
which is an isomorphism by Lemma \ref{lemma-V-implies-C-general};
the lemma applies because $f_\tau^{-1}\mathcal{F}$ is in $\mathcal{A}_X$
by Lemma \ref{lemma-A}. Choose a distinguished triangle
$$
\epsilon_{Y, *}\mathcal{F} \to K \to L \to \epsilon_{Y, *}\mathcal{F}[1]
$$
The map $\mathcal{F} \to f_{\tau, *}f_\tau^{-1}\mathcal{F}$
is injective as $\{X \to Y\}$ is a $\tau$-covering. Thus
$\epsilon_{Y, *}\mathcal{F} \to
\epsilon_{Y, *}f_{\tau, *}f_\tau^{-1}\mathcal{F} =
f_{\tau', *}f_{\tau'}^{-1}\epsilon_{Y, *}\mathcal{F}$
is injective too. 
Hence $L$ only has nonzero cohomology sheaves in degrees $0, \ldots, n$.
As $f_{\tau', *}f_{\tau'}^{-1}\epsilon_{Y, *}\mathcal{F}$
is in $\mathcal{A}'_Y$ by (\ref{item-restriction-A}) and
(\ref{item-A-and-P}) we conclude that
$$
H^0(L) = \Coker(\epsilon_{Y, *}\mathcal{F} \to
f_{\tau', *}f_{\tau'}^{-1}\epsilon_{Y, *}\mathcal{F})
$$
is in the weak Serre subcategory $\mathcal{A}'_Y$. For $1 \leq i \leq n$
we see that $H^i(L) = R^if_{\tau', *}f_{\tau'}^{-1}\epsilon_{Y, *}\mathcal{F}$
is in $\mathcal{A}'_Y$ by (\ref{item-restriction-A}) and
(\ref{item-A-and-P}). Pulling back the distinguished triangle
above by $\epsilon_Y$ we get the distinguished triangle
$$
\mathcal{F} \to \tau_{\leq n}Rf_{\tau, *}f_\tau^{-1}\mathcal{F}
\to \epsilon_Y^{-1}L \to \mathcal{F}[1]
$$
Since $\xi$ maps to zero in the middle term we find
that $\xi$ is the image of an element
$\xi' \in H^n_\tau(Y, \epsilon_Y^{-1}L)$.
By Lemma \ref{lemma-V-implies-cohomology-general} we have
$$
H^n_{\tau'}(Y, L) = H^n_\tau(Y, \epsilon_Y^{-1}L),
$$
Thus we may lift $\xi'$ to an element of $H^n_{\tau'}(Y, L)$
and take the boundary into
$H^{n + 1}_{\tau'}(Y, \epsilon_{Y, *}\mathcal{F})$
to see that $\xi$ is in the image of the canonical map
$H^{n + 1}_{\tau'}(Y, \epsilon_{Y, *}\mathcal{F}) \to
H^{n + 1}_\tau(Y, \mathcal{F})$.
By locality of cohomology for
$H^{n + 1}_{\tau'}(Y,\epsilon_{Y, *}\mathcal{F})$, see
Lemma \ref{lemma-kill-cohomology-class-on-covering},
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-V-C-all-n-general}
In Situation \ref{situation-compare} we have that
$(V_n)$ is true for all $n$. Moreover:
\begin{enumerate}
\item For $X$ in $\mathcal{C}$ and
$K' \in D^+_{\mathcal{A}'_X}(\mathcal{C}_{\tau'}/X)$ the map
$K' \to R\epsilon_{X, *}(\epsilon_X^{-1}K')$ is an isomorphism.
\item For $f : X \to Y$ in $\mathcal{P}$ and
$K' \in D^+_{\mathcal{A}'_X}(\mathcal{C}_{\tau'}/X)$ we have
$Rf_{\tau', *}K' \in D^+_{\mathcal{A}'_X}(\mathcal{C}_{\tau'}/Y)$ and
$\epsilon_Y^{-1}(Rf_{\tau', *}K') = Rf_{\tau, *}(\epsilon_X^{-1}K')$.
\end{enumerate}
\end{lemma}

\begin{proof}
Observe that $(V_0)$ holds as it is the empty condition.
Then we get $(V_n)$ for all $n$ by
Lemma \ref{lemma-induction-step-V-C-general}.

\medskip\noindent
Proof of (1). The object $K = \epsilon_X^{-1}K'$ has cohomology
sheaves $H^i(K) = \epsilon_X^{-1}H^i(K')$ in $\mathcal{A}_X$.
Hence the spectral sequence
$$
E_2^{p, q} = R^p\epsilon_{X, *} H^q(K) \Rightarrow
H^{p + q}(R\epsilon_{X, *}K)
$$
degenerates by $(V_n)$ for all $n$ and we find
$$
H^n(R\epsilon_{X, *}K) = \epsilon_{X, *}H^n(K) =
\epsilon_{X, *}\epsilon_X^{-1}H^i(K') = H^i(K').
$$
again because $H^i(K')$ is in $\mathcal{A}'_X$.
Thus the canonical map $K' \to R\epsilon_{X, *}(\epsilon_X^{-1}K')$
is an isomorphism.

\medskip\noindent
Proof of (2). Using the spectral sequence
$$
E_2^{p, q} = R^pf_{\tau', *}H^q(K') \Rightarrow R^{p + q}f_{\tau', *}K'
$$
the fact that $R^pf_{\tau', *}H^q(K')$ is in
$\mathcal{A}'_Y$ by (\ref{item-A-and-P}),
the fact that $\mathcal{A}'_Y$ is a weak Serre subcategory of
$\textit{Ab}(\mathcal{C}_{\tau'}/Y)$,
and Homology, Lemma \ref{homology-lemma-biregular-ss-converges}
we conclude that
$Rf_{\tau', *}K' \in D^+_{\mathcal{A}'_X}(\mathcal{C}_{\tau'}/X)$.
To finish the proof we have to show the base change map
$$
\epsilon_Y^{-1}(Rf_{\tau', *}K')
\longrightarrow
Rf_{\tau, *}(\epsilon_X^{-1}K')
$$
is an isomorphism. Comparing the spectral sequence above to the
spectral sequence
$$
E_2^{p, q} = R^pf_{\tau, *}H^q(\epsilon_X^{-1}K')
\Rightarrow R^{p + q}f_{\tau, *}\epsilon_X^{-1}K'
$$
we reduce this to the case where $K'$ has a single nonzero
cohomology sheaf $\mathcal{F}'$ in $\mathcal{A}'_X$; details omitted.
Then Lemma \ref{lemma-V-implies-C-general} gives
$\epsilon_Y^{-1}R^if_{\tau', *}\mathcal{F}' =
R^if_{\tau, *}\epsilon_X^{-1}\mathcal{F}'$ for all $i$
and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-cohomological-descent-general}
In Situation \ref{situation-compare}. For any $X$ in
$\mathcal{C}$ the category
$\mathcal{A}_X \subset \textit{Ab}(\mathcal{C}_\tau/X)$
is a weak Serre subcategory and the functor
$$
R\epsilon_{X, *} :
D^+_{\mathcal{A}_X}(\mathcal{C}_\tau/X)
\longrightarrow
D^+_{\mathcal{A}'_X}(\mathcal{C}_{\tau'}/X)
$$
is an equivalence with quasi-inverse given by $\epsilon_X^{-1}$.
\end{lemma}

\begin{proof}
We need to check the conditions listed in
Homology, Lemma \ref{homology-lemma-characterize-weak-serre-subcategory}
for $\mathcal{A}_X$. If $\varphi : \mathcal{F} \to \mathcal{G}$ is a map
in $\mathcal{A}_X$, then $\epsilon_{X, *}\varphi :
\epsilon_{X, *}\mathcal{F} \to \epsilon_{X, *}\mathcal{G}$
is a map in $\mathcal{A}'_X$. Hence $\Ker(\epsilon_{X, *}\varphi)$ and
$\Coker(\epsilon_{X, *}\varphi)$ are objects of $\mathcal{A}'_X$
as this is a weak Serre subcategory of $\textit{Ab}(\mathcal{C}_{\tau'}/X)$.
Applying $\epsilon_X^{-1}$ we obtain an exact sequence
$$
0 \to
\epsilon_X^{-1}\Ker(\epsilon_{X, *}\varphi) \to
\mathcal{F} \to \mathcal{G} \to
\epsilon_X^{-1}\Coker(\epsilon_{X, *}\varphi) \to 0
$$
and we see that $\Ker(\varphi)$ and $\Coker(\varphi)$ are in
$\mathcal{A}_X$. Finally, suppose that
$$
0 \to \mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3 \to 0
$$
is a short exact sequence in $\textit{Ab}(\mathcal{C}_\tau/X)$
with $\mathcal{F}_1$ and $\mathcal{F}_3$ in $\mathcal{A}_X$.
Then applying $\epsilon_{X, *}$ we obtain an exact sequence
$$
0 \to 
\epsilon_{X, *}\mathcal{F}_1 \to
\epsilon_{X, *}\mathcal{F}_2 \to
\epsilon_{X, *}\mathcal{F}_3 \to
R^1\epsilon_{X, *}\mathcal{F}_1 = 0
$$
Vanishing by Lemma \ref{lemma-V-C-all-n-general}.
Hence $\epsilon_{X, *}\mathcal{F}_2$ is in $\mathcal{A}'_X$
as this is a weak Serre subcategory of $\textit{Ab}(\mathcal{C}_{\tau'}/X)$.
Pulling back by $\epsilon_X$ we conclude that
$\mathcal{F}_2$ is in $\mathcal{A}_X$.

\medskip\noindent
Thus $\mathcal{A}_X$ is a weak Serre subcategory of
$\textit{Ab}(\mathcal{C}_\tau/X)$ and it makes sense
to consider the category $D^+_{\mathcal{A}_X}(\mathcal{C}_\tau/X)$.
Observe that $\epsilon_X^{-1} : \mathcal{A}'_X \to \mathcal{A}_X$
is an equivalence and that
$\mathcal{F}' \to R\epsilon_{X, *}\epsilon_X^{-1}\mathcal{F}'$
is an isomorphism for $\mathcal{F}'$ in $\mathcal{A}'_X$ since we
have $(V_n)$ for all $n$ by Lemma \ref{lemma-V-C-all-n-general}.
Thus we conclude by Lemma \ref{lemma-equivalence-bounded}.
\end{proof}

\begin{lemma}
\label{lemma-compare-cohomology-general}
In Situation \ref{situation-compare}. Let $X$ be in $\mathcal{C}$.
\begin{enumerate}
\item for $\mathcal{F}'$ in $\mathcal{A}'_X$ we have
$H^n_{\tau'}(X, \mathcal{F}') = H^n_\tau(X, \epsilon_X^{-1}\mathcal{F}')$,
\item for $K' \in D^+_{\mathcal{A}'_X}(\mathcal{C}_{\tau'}/X)$
we have $H^n_{\tau'}(X, K') = H^n_\tau(X, \epsilon_X^{-1}K')$.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-V-C-all-n-general}
by Remark \ref{remark-before-Leray}.
\end{proof}
























\section{Cohomology on Hausdorff and locally quasi-compact spaces}
\label{section-cohomology-LC}

\noindent
We continue our convention to say ``Hausdorff and locally quasi-compact''
instead of saying ``locally compact'' as is often done in the literature.
Let $\textit{LC}$ denote the category whose objects are Hausdorff and
locally quasi-compact topological spaces and whose morphisms are continuous
maps.

\begin{lemma}
\label{lemma-LC-basic}
The category $\textit{LC}$ has fibre products and a final object and hence
has arbitrary finite limits. Given morphisms $X \to Z$ and $Y \to Z$
in $\textit{LC}$ with
$X$ and $Y$ quasi-compact, then $X \times_Z Y$ is quasi-compact.
\end{lemma}

\begin{proof}
The final object is the singleton space. Given morphisms $X \to Z$ and
$Y \to Z$ of $\textit{LC}$ the fibre product $X \times_Z Y$ is
a subspace of $X \times Y$. Hence $X \times_Z Y$ is Hausdorff as
$X \times Y$ is Hausdorff by
Topology, Section \ref{topology-section-Hausdorff}.

\medskip\noindent
If $X$ and $Y$ are quasi-compact, then $X \times Y$ is quasi-compact by 
Topology, Theorem \ref{topology-theorem-tychonov}.
Since $X \times_Z Y$ is a closed subset of $X \times Y$
(Topology, Lemma \ref{topology-lemma-fibre-product-closed})
we find that $X \times_Z Y$ is quasi-compact by
Topology, Lemma \ref{topology-lemma-closed-in-quasi-compact}.

\medskip\noindent
Finally, returning to the general case, if $x \in X$ and $y \in Y$
we can pick quasi-compact neighbourhoods $x \in E \subset X$ and
$y \in F \subset Y$ and we find that $E \times_Z F$ is a quasi-compact
neighbourhood of $(x, y)$ by the result above. Thus $X \times_Z Y$
is an object of $\textit{LC}$ by
Topology, Lemma \ref{topology-lemma-locally-quasi-compact-Hausdorff}.
\end{proof}

\noindent
We can endow $\textit{LC}$ with a stronger topology than the usual one.

\begin{definition}
\label{definition-covering-LC}
Let $\{f_i : X_i \to X\}$ be a family of morphisms with fixed target
in the category $\textit{LC}$. We say this family is a
{\it qc covering}\footnote{This is nonstandard notation.
We chose it to remind the reader of fpqc coverings of schemes.}
if for every $x \in X$ there exist $i_1, \ldots, i_n \in I$ and
quasi-compact subsets $E_j \subset X_{i_j}$ such that
$\bigcup f_{i_j}(E_j)$ is a neighbourhood of $x$.
\end{definition}

\noindent
Observe that an open covering $X = \bigcup U_i$ of an object of $\textit{LC}$
gives a qc covering $\{U_i \to X\}$ because $X$ is locally quasi-compact.
We start with the obligatory lemma.

\begin{lemma}
\label{lemma-qc}
Let $X$ be a Hausdorff and locally quasi-compact space, in other words,
an object of $\textit{LC}$.
\begin{enumerate}
\item If $X' \to X$ is an isomorphism in $\textit{LC}$ then
$\{X' \to X\}$ is a qc covering.
\item If $\{f_i : X_i \to X\}_{i\in I}$ is a qc covering and for each
$i$ we have a qc covering $\{g_{ij} : X_{ij} \to X_i\}_{j\in J_i}$, then
$\{X_{ij} \to X\}_{i \in I, j\in J_i}$ is a qc covering.
\item If $\{X_i \to X\}_{i\in I}$ is a qc covering
and $X' \to X$ is a morphism of $\textit{LC}$ then
$\{X' \times_X X_i \to X'\}_{i\in I}$ is a qc covering.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) holds by the remark above that open coverings are qc coverings.

\medskip\noindent
Proof of (2). Let $x \in X$. Choose $i_1, \ldots, i_n \in I$ and
$E_a \subset X_{i_a}$ quasi-compact such that $\bigcup f_{i_a}(E_a)$
is a neighbourhood of $x$. For every $e \in E_a$ we can find
a finite subset $J_e \subset J_{i_a}$ and quasi-compact
$F_{e, j} \subset X_{ij}$, $j \in J_e$ such that $\bigcup g_{ij}(F_{e, j})$
is a neighbourhood of $e$. Since $E_a$ is quasi-compact we find
a finite collection $e_1, \ldots, e_{m_a}$ such that
$$
E_a \subset
\bigcup\nolimits_{k = 1, \ldots, m_a}
\bigcup\nolimits_{j \in J_{e_k}} g_{ij}(F_{e_k, j})
$$
Then we find that
$$
\bigcup\nolimits_{a = 1, \ldots, n}
\bigcup\nolimits_{k = 1, \ldots, m_a}
\bigcup\nolimits_{j \in J_{e_k}} f_i(g_{ij}(F_{e_k, j}))
$$
is a neighbourhood of $x$.

\medskip\noindent
Proof of (3). Let $x' \in X'$ be a point. Let $x \in X$ be its image.
Choose $i_1, \ldots, i_n \in I$ and quasi-compact subsets
$E_j \subset X_{i_j}$ such that $\bigcup f_{i_j}(E_j)$ is a
neighbourhood of $x$. Choose a quasi-compact neighbourhood $F \subset X'$
of $x'$ which maps into the quasi-compact neighbourhood
$\bigcup f_{i_j}(E_j)$ of $x$. Then
$F \times_X E_j \subset X' \times_X X_{i_j}$ is a
quasi-compact subset and $F$ is the image of the map
$\coprod F \times_X E_j \to F$. Hence the base change is a
qc covering and the proof is finished.
\end{proof}

\noindent
Since all objects of $\textit{LC}$ are Hausdorff any morphism
$f : X \to Y$ of $\textit{LC}$ is a separated continuous map
of topological spaces. Hence $f$ is a proper map of topological spaces
if and only if $f$ is universally closed. See discussion in
Topology, Section \ref{topology-section-proper}.

\begin{lemma}
\label{lemma-proper-surjective-is-qc-covering}
Let $f : X \to Y$ be a morphism of $\textit{LC}$.
If $f$ is proper and surjective, then $\{f : X \to Y\}$
is a qc covering.
\end{lemma}

\begin{proof}
Let $y \in Y$ be a point. For each $x \in X_y$ choose a quasi-compact
neighbourhood $E_x \subset X$. Choose $x \in U_x \subset E_x$ open.
Since $f$ is proper the fibre $X_y$ is quasi-compact and we find
$x_1, \ldots, x_n \in X_y$ such that
$X_y \subset U_{x_1} \cup \ldots \cup U_{x_n}$.
We claim that $f(E_{x_1}) \cup \ldots \cup f(E_{x_n})$ is a neighbourhood of
$y$. Namely, as $f$ is closed
(Topology, Theorem \ref{topology-theorem-characterize-proper})
we see that $Z = f(X \setminus U_{x_1} \cup \ldots \cup U_{x_n})$
is a closed subset of $Y$ not containing $y$. As $f$ is surjective
we see that $Y \setminus Z$ is contained in
$f(E_{x_1}) \cup \ldots \cup f(E_{x_n})$ as desired.
\end{proof}

\noindent
Besides some set theoretic issues Lemma \ref{lemma-qc} shows that
$\textit{LC}$ with the collection of qc coverings forms a site.
We will denote this site (suitably modified to overcome the
set theoretical issues)
$\textit{LC}_{qc}$.

\begin{remark}[Set theoretic issues]
\label{remark-set-theoretic-LC}
The category $\textit{LC}$ is a ``big'' category as its objects form
a proper class. Similarly, the coverings form a proper class.
Let us define the {\it size} of a topological space $X$ to be the
cardinality of the set of points of $X$. Choose a function
$Bound$ on cardinals, for example as in
Sets, Equation (\ref{sets-equation-bound}).
Finally, let $S_0$ be an initial set of objects of $\textit{LC}$,
for example $S_0 = \{(\mathbf{R}, \text{euclidean topology})\}$.
Exactly as in Sets, Lemma \ref{sets-lemma-construct-category}
we can choose a limit ordinal $\alpha$ such that
$\textit{LC}_\alpha = \textit{LC} \cap V_\alpha$
contains $S_0$ and is preserved under all countable limits and
colimits which exist in $\textit{LC}$. Moreover, if $X \in \textit{LC}_\alpha$
and if $Y \in \textit{LC}$ and
$\text{size}(Y) \leq Bound(\text{size}(X))$, then $Y$ is isomorphic
to an object of $\textit{LC}_\alpha$.
Next, we apply Sets, Lemma \ref{sets-lemma-coverings-site}
to choose set $\text{Cov}$ of qc covering on $\textit{LC}_\alpha$
such that every qc covering in $\textit{LC}_\alpha$ is
combinatorially equivalent to a covering this set.
In this way we obtain a site $(\textit{LC}_\alpha, \text{Cov})$
which we will denote $\textit{LC}_{qc}$.
\end{remark}

\noindent
There is a second topology on the site $\textit{LC}_{qc}$ of
Remark \ref{remark-set-theoretic-LC}. Namely, given an object
$X$ we can consider all coverings $\{X_i \to X\}$ of $\textit{LC}_{qc}$
such that $X_i \to X$ is an open immersion. We denote this site
$\textit{LC}_{Zar}$. The identity functor
$\textit{LC}_{Zar} \to \textit{LC}_{qc}$ is continuous and defines
a morphism of sites
$$
\epsilon : \textit{LC}_{qc} \longrightarrow \textit{LC}_{Zar}
$$
See Section \ref{section-compare}.
For a Hausdorff and locally quasi-compact topological space $X$, more
precisely for $X \in \Ob(\textit{LC}_{qc})$, we denote the induced morphism
$$
\epsilon_X : \textit{LC}_{qc}/X \longrightarrow \textit{LC}_{Zar}/X
$$
(see Sites, Lemma \ref{sites-lemma-localize-morphism}).
Let $X_{Zar}$ be the site whose objects are opens of $X$, see
Sites, Example \ref{sites-example-site-topological}.
There is a morphism of sites
$$
\pi_X : \textit{LC}_{Zar}/X \longrightarrow X_{Zar}
$$
given by the continuous functor
$X_{Zar} \to \textit{LC}_{Zar}/X$, $U \mapsto U$.
Namely, $X_{Zar}$ has fibre products and a final object and the
functor above commutes with these and
Sites, Proposition \ref{sites-proposition-get-morphism} applies.
We often think of $\pi$ as a morphism of topoi
$$
\pi_X : \Sh(\textit{LC}_{Zar}/X) \longrightarrow \Sh(X)
$$
using the equality $\Sh(X_{Zar}) = \Sh(X)$.

\begin{lemma}
\label{lemma-describe-pullback-pi}
Let $X$ be an object of $\textit{LC}_{qc}$. Let $\mathcal{F}$ be a
sheaf on $X$. The rule
$$
\textit{LC}_{qc}/X \longrightarrow \textit{Sets},\quad
(f : Y \to X) \longmapsto \Gamma(Y, f^{-1}\mathcal{F})
$$
is a sheaf and a fortiori also a sheaf on $\textit{LC}_{Zar}/X$.
This sheaf is equal to
$\pi_X^{-1}\mathcal{F}$ on $\textit{LC}_{Zar}/X$ and
$\epsilon_X^{-1}\pi_X^{-1}\mathcal{F}$ on $\textit{LC}_{qc}/X$.
\end{lemma}

\begin{proof}
Denote $\mathcal{G}$ the presheaf given by the formula in the lemma.
Of course the pullback $f^{-1}$ in the formula denotes usual
pullback of sheaves on topological spaces. It is immediate
from the definitions that $\mathcal{G}$ is a sheaf for the Zar
topology.

\medskip\noindent
Let $Y \to X$ be a morphism in $\textit{LC}_{qc}$. Let
$\mathcal{V} = \{g_i : Y_i \to Y\}_{i \in I}$ be a qc covering.
To prove $\mathcal{G}$ is a sheaf for the qc topology it
suffices to show that
$\mathcal{G}(Y) \to H^0(\mathcal{V}, \mathcal{G})$
is an isomorphism, see Sites, Section \ref{sites-section-sheafification}.
We first point out that the map is injective as a qc covering
is surjective and we can detect equality of sections at stalks
(use Sheaves, Lemmas \ref{sheaves-lemma-sheaf-subset-stalks} and
\ref{sheaves-lemma-stalk-pullback-presheaf}). Thus
$\mathcal{G}$ is a separated presheaf on $\textit{LC}_{qc}$
hence it suffices to show that any element
$(s_i) \in H^0(\mathcal{V}, \mathcal{G})$
maps to an element in the image of $\mathcal{G}(Y)$
after replacing $\mathcal{V}$ by a refinement
(Sites, Theorem \ref{sites-theorem-plus}).

\medskip\noindent
Identifying sheaves on $Y_{i, Zar}$ and sheaves on $Y_i$ we find that
$\mathcal{G}|_{Y_{i, Zar}}$ is the pullback of $f^{-1}\mathcal{F}$ under
the continuous map $g_i : Y_i \to Y$. Thus we can choose an open covering
$Y_i = \bigcup V_{ij}$ such that for each $j$ there is an open
$W_{ij} \subset Y$ and a section $t_{ij} \in \mathcal{G}(W_{ij})$
such that $V_{ij}$ maps into $W_{ij}$ and such that
$s|_{V_{ij}}$ is the pullback of $t_{ij}$. In other words,
after refining the covering $\{Y_i \to Y\}$ we may assume there
are opens $W_i \subset Y$ such that $Y_i \to Y$ factors through $W_i$
and sections $t_i$ of $\mathcal{G}$ over $W_i$ which restrict
to the given sections $s_i$. Moreover, if $y \in Y$ is in the image
of both $Y_i \to Y$ and $Y_j \to Y$, then the images $t_{i, y}$
and $t_{j, y}$ in the stalk $f^{-1}\mathcal{F}_y$ agree
(because $s_i$ and $s_j$ agree over $Y_i \times_Y Y_j$).
Thus for $y \in Y$ there is a well defined element $t_y$ of
$f^{-1}\mathcal{F}_y$ agreeing with $t_{i, y}$ whenever $y$
is in the image of $Y_i \to Y$.
We will show that the element $(t_y)$ comes from a global section
of $f^{-1}\mathcal{F}$ over $Y$ which will finish the proof of the lemma.

\medskip\noindent
It suffices to show that this is true locally on $Y$, see
Sheaves, Section \ref{sheaves-section-sheafification}. Let $y_0 \in Y$.
Pick $i_1, \ldots, i_n \in I$ and
quasi-compact subsets $E_j \subset Y_{i_j}$ such that
$\bigcup g_{i_j}(E_j)$ is a neighbourhood of $y_0$.
Let $V \subset Y$ be an open neighbourhood of $y_0$ contained
in $\bigcup g_{i_j}(E_j)$ and contained in $W_{i_1} \cap \ldots \cap W_{i_n}$.
Since $t_{i_1, y_0} = \ldots = t_{i_n, y_0}$, after shrinking $V$
we may assume the sections $t_{i_j}|_V$, $j = 1, \ldots, n$ of
$f^{-1}\mathcal{F}$ agree. As $V \subset \bigcup g_{i_j}(E_j)$
we see that $(t_y)_{y \in V}$ comes from this section.

\medskip\noindent
We still have to show that $\mathcal{G}$ is equal to
$\epsilon_X^{-1}\pi_X^{-1}\mathcal{F}$ on $\textit{LC}_{qc}$,
resp.\ $\pi_X^{-1}\mathcal{F}$ on $\textit{LC}_{Zar}$.
In both cases the pullback is defined by taking the presheaf
$$
(f : Y \to X)
\longmapsto
\colim_{f(Y) \subset U \subset X} \mathcal{F}(U)
$$
and then sheafifying. Sheafifying in the Zar topology
exactly produces our sheaf $\mathcal{G}$ and the fact
that $\mathcal{G}$ is a qc sheaf, shows that it works as well
in the qc topology.
\end{proof}

\noindent
Let $X \in \Ob(\textit{LC}_{Zar})$ and let $\mathcal{H}$
be an abelian sheaf on $\textit{LC}_{Zar}/X$. 
Then we will write $H^n_{Zar}(U, \mathcal{H})$ for the cohomology
of $\mathcal{H}$ over an object $U$ of $\textit{LC}_{Zar}/X$.

\begin{lemma}
\label{lemma-collect-true-things-Zar}
Let $X$ be an object of $\textit{LC}_{Zar}$. Then
\begin{enumerate}
\item for $\mathcal{F} \in \textit{Ab}(X)$ we have
$H^n_{Zar}(X, \pi_X^{-1}\mathcal{F}) = H^n(X, \mathcal{F})$,
\item $\pi_{X, *} : \textit{Ab}(\textit{LC}_{Zar}/X) \to \textit{Ab}(X)$
is exact,
\item the unit $\text{id} \to \pi_{X, *} \circ \pi_X^{-1}$
of the adjunction is an isomorphism, and
\item for $K \in D(X)$ the canonical map
$K \to R\pi_{X, *} \pi_X^{-1}K$ is an isomorphism.
\end{enumerate}
Let $f : X \to Y$ be a morphism of $\textit{LC}_{Zar}$. Then
\begin{enumerate}
\item[(5)] there is a commutative diagram
$$
\xymatrix{
\Sh(\textit{LC}_{Zar}/X) \ar[r]_{f_{Zar}} \ar[d]_{\pi_X} &
\Sh(\textit{LC}_{Zar}/Y) \ar[d]^{\pi_Y} \\
\Sh(X_{Zar}) \ar[r]^f &
\Sh(Y_{Zar})
}
$$
of topoi,
\item[(6)] for $L \in D^+(Y)$ we have
$H^n_{Zar}(X, \pi_Y^{-1}L) = H^n(X, f^{-1}L)$,
\item[(7)] if $f$ is proper, then we have
\begin{enumerate}
\item $\pi_Y^{-1} \circ f_* = f_{Zar, *} \circ \pi_X^{-1}$ as functors
$\Sh(X) \to \Sh(\textit{LC}_{Zar}/Y)$,
\item $\pi_Y^{-1} \circ Rf_* = Rf_{Zar, *} \circ \pi_X^{-1}$ as
functors $D^+(X) \to D^+(\textit{LC}_{Zar}/Y)$.
\end{enumerate}
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1).
The equality $H^n_{Zar}(X, \pi_X^{-1}\mathcal{F}) = H^n(X, \mathcal{F})$
is a general fact coming from the trivial observation that
coverings of $X$ in $\textit{LC}_{Zar}$ are the same thing as open
coverings of $X$. The reader who wishes to see a detailed proof
should apply Lemma \ref{lemma-cohomology-bigger-site} to the functor
$X_{Zar} \to \textit{LC}_{Zar}$.

\medskip\noindent
Proof of (2). This is true because $\pi_{X, *} = \tau_X^{-1}$
for some morphism of topoi $\tau_X : \Sh(X_{Zar}) \to \Sh(\textit{LC}_{Zar})$
as follows from Sites, Lemma \ref{sites-lemma-bigger-site}
applied to the functor
$X_{Zar} \to \textit{LC}_{Zar}/X$ used to define $\pi_X$.

\medskip\noindent
Proof of (3). This is true because $\tau_X^{-1} \circ \pi_X^{-1}$
is the identity functor by Sites, Lemma \ref{sites-lemma-bigger-site}.
Or you can deduce it from the explicit description of
$\pi_X^{-1}$ in Lemma \ref{lemma-describe-pullback-pi}.

\medskip\noindent
Proof of (4). Apply (3) to an complex of abelian sheaves representing $K$.

\medskip\noindent
Proof of (5). The morphism of topoi $f_{Zar}$ comes from an application of
Sites, Lemma \ref{sites-lemma-relocalize}
and in our case comes from the continuous functor
$Z/Y \mapsto Z \times_Y X/X$ by
Sites, Lemma \ref{sites-lemma-relocalize-given-fibre-products}.
The diagram commutes simply because the corresponding
continuous functors compose correctly
(see Sites, Lemma \ref{sites-lemma-composition-morphisms-sites}).

\medskip\noindent
Proof of (6). We have
$H^n_{Zar}(X, \pi_Y^{-1}\mathcal{G}) =
H^n_{Zar}(X, f_{Zar}^{-1}\pi_Y^{-1}\mathcal{G})$
for $\mathcal{G}$ in $\textit{Ab}(Y)$, see
Lemma \ref{lemma-cohomology-of-open}.
This is equal to $H^n_{Zar}(X, \pi_X^{-1}f^{-1}\mathcal{G})$
by the commutativity of the diagram in (5).
Hence we conclude by (1) in the case $L$ consists of a single
sheaf in degree $0$. The general case follows by representing
$L$ by a bounded below complex of abelian sheaves.

\medskip\noindent
Proof of (7a). Let $\mathcal{F}$ be a sheaf on $X$.
Let $g : Z \to Y$ be an object of $\textit{LC}_{Zar}/Y$. Consider the
fibre product
$$
\xymatrix{
Z' \ar[r]_{f'} \ar[d]_{g'} & Z \ar[d]^g \\
X \ar[r]^f & Y
}
$$
Then we have
$$
(f_{Zar, *}\pi_X^{-1}\mathcal{F})(Z/Y) =
(\pi_X^{-1}\mathcal{F})(Z'/X)  =
\Gamma(Z', (g')^{-1}\mathcal{F})  =
\Gamma(Z, f'_*(g')^{-1}\mathcal{F})
$$
the second equality by Lemma \ref{lemma-describe-pullback-pi}.
On the other hand
$$
(\pi_Y^{-1}f_*\mathcal{F})(Z/Y) = \Gamma(Z, g^{-1}f_*\mathcal{F})
$$
again by Lemma \ref{lemma-describe-pullback-pi}.
Hence by proper base change for sheaves of sets
(Cohomology, Lemma \ref{cohomology-lemma-proper-base-change-sheaves-of-sets})
we conclude the two sets are canonically isomorphic.
The isomorphism is compatible with restriction mappings
and defines an isomorphism
$\pi_Y^{-1}f_*\mathcal{F} = f_{Zar, *}\pi_X^{-1}\mathcal{F}$.
Thus an isomorphism of functors
$\pi_Y^{-1} \circ f_* = f_{Zar, *} \circ \pi_X^{-1}$.

\medskip\noindent
Proof of (7b). Let $K \in D^+(X)$. By
Lemma \ref{lemma-unbounded-describe-higher-direct-images}
the $n$th cohomology sheaf of
$Rf_{Zar, *}\pi_X^{-1}K$ is the sheaf associated to the presheaf
$$
(g : Z \to Y) \longmapsto H^n_{Zar}(Z', \pi_X^{-1}K)
$$
with notation as above. Observe that
\begin{align*}
H^n_{Zar}(Z', \pi_X^{-1}K)
& =
H^n(Z', (g')^{-1}K) \\
& =
H^n(Z, Rf'_*(g')^{-1}K) \\
& =
H^n(Z, g^{-1}Rf_*K) \\
& =
H^n_{Zar}(Z, \pi_Y^{-1}Rf_*K)
\end{align*}
The first equality is (6) applied to $K$ and $g' : Z' \to X$.
The second equality is Leray for $f' : Z' \to Z$
(Cohomology, Lemma \ref{cohomology-lemma-before-Leray}).
The third equality is the proper base change theorem
(Cohomology, Theorem \ref{cohomology-theorem-proper-base-change}).
The fourth equality is (6) applied to $g : Z \to Y$ and $Rf_*K$.
Thus $Rf_{Zar, *}\pi_X^{-1}K$ and $\pi_Y^{-1}Rf_*K$ have the same
cohomology sheaves. We omit the verification that the
canonical base change map $\pi_Y^{-1}Rf_*K \to Rf_{Zar, *}\pi_X^{-1}K$
induces this isomorphism.
\end{proof}

\noindent
In the situation of Lemma \ref{lemma-describe-pullback-pi}
the composition of $\epsilon$ and $\pi$ and the equality
$\Sh(X) = \Sh(X_{Zar})$ determine a morphism of topoi
$$
a_X : \Sh(\textit{LC}_{qc}/X) \longrightarrow \Sh(X)
$$

\begin{lemma}
\label{lemma-push-pull-LC}
Let $f : X \to Y$ be a morphism of $\textit{LC}_{qc}$.
Then there are commutative diagrams of topoi
$$
\vcenter{
\xymatrix{
\Sh(\textit{LC}_{qc}/X) \ar[r]_{f_{qc}} \ar[d]_{\epsilon_X} &
\Sh(\textit{LC}_{qc}/Y) \ar[d]^{\epsilon_Y} \\
\Sh(\textit{LC}_{Zar}/X) \ar[r]^{f_{Zar}} &
\Sh(\textit{LC}_{Zar}/Y)
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
\Sh(\textit{LC}_{qc}/X) \ar[r]_{f_{qc}} \ar[d]_{a_X} &
\Sh(\textit{LC}_{qc}/Y) \ar[d]^{a_Y} \\
\Sh(X) \ar[r]^f &
\Sh(Y)
}
}
$$
with $a_X = \pi_X \circ \epsilon_X$, $a_Y = \pi_X \circ \epsilon_X$.
If $f$ is proper, then $a_Y^{-1} \circ f_* = f_{qc, *} \circ a_X^{-1}$.
\end{lemma}

\begin{proof}
The morphism of topoi $f_{qc}$ is the one from
Sites, Lemma \ref{sites-lemma-relocalize}
which in our case comes from the continuous functor
$Z/Y \mapsto Z \times_Y X/X$, see
Sites, Lemma \ref{sites-lemma-relocalize-given-fibre-products}.
The diagram on the left commutes because the corresponding
continuous functors compose correctly
(see Sites, Lemma \ref{sites-lemma-composition-morphisms-sites}).
The diagram on the right commutes because the one on the left does
and because of part (5) of Lemma \ref{lemma-collect-true-things-Zar}.

\medskip\noindent
Proof of the final assertion. The reader may repeat the proof of part (7a) of
Lemma \ref{lemma-collect-true-things-Zar}; we will instead deduce this from it.
As $\epsilon_{Y, *}$ is the identity functor on underlying presheaves,
it reflects isomorphisms. The description
in Lemma \ref{lemma-describe-pullback-pi}
shows that $\epsilon_{Y, *} \circ a_Y^{-1} = \pi_Y^{-1}$
and similarly for $X$. To show that the canonical map
$a_Y^{-1}f_*\mathcal{F} \to f_{qc, *}a_X^{-1}\mathcal{F}$
is an isomorphism, it suffices to show that
$$
\pi_Y^{-1}f_*\mathcal{F} =
\epsilon_{Y, *}a_Y^{-1}f_*\mathcal{F} \to
\epsilon_{Y, *}f_{qc, *}a_X^{-1}\mathcal{F} =
f_{Zar, *}\epsilon_{X, *}a_X^{-1}\mathcal{F} =
f_{Zar, *}\pi_X^{-1}\mathcal{F}
$$
is an isomorphism. This is part
(7a) of Lemma \ref{lemma-collect-true-things-Zar}.
\end{proof}

\begin{lemma}
\label{lemma-compare-qc-zar}
Consider the comparison morphism
$\epsilon : \textit{LC}_{qc} \to \textit{LC}_{Zar}$.
Let $\mathcal{P}$ denote the class of proper maps of topological spaces.
For $X$ in $\textit{LC}_{Zar}$ denote
$\mathcal{A}'_X \subset \textit{Ab}(\textit{LC}_{Zar}/X)$
the full subcategory consisting of sheaves of the form
$\pi_X^{-1}\mathcal{F}$ with $\mathcal{F}$ in $\textit{Ab}(X)$.
Then
(\ref{item-base-change-P}),
(\ref{item-restriction-A}),
(\ref{item-A-sheaf}),
(\ref{item-A-and-P}), and
(\ref{item-refine-tau-by-P})
of Situation \ref{situation-compare} hold.
\end{lemma}

\begin{proof}
We first show that $\mathcal{A}'_X \subset \textit{Ab}(\textit{LC}_{Zar}/X)$
is a weak Serre subcategory by checking conditions (1), (2), (3), and (4)
of Homology, Lemma \ref{homology-lemma-characterize-weak-serre-subcategory}.
Parts (1), (2), (3) are immediate as $\pi_X^{-1}$ is exact and
fully faithful by Lemma \ref{lemma-collect-true-things-Zar} part (3). If
$0 \to \pi_X^{-1}\mathcal{F} \to \mathcal{G} \to \pi_X^{-1}\mathcal{F}' \to 0$
is a short exact sequence in $\textit{Ab}(\textit{LC}_{Zar}/X)$
then $0 \to \mathcal{F} \to \pi_{X, *}\mathcal{G} \to \mathcal{F}' \to 0$
is exact by Lemma \ref{lemma-collect-true-things-Zar} part (2).
Hence $\mathcal{G} = \pi_X^{-1}\pi_{X, *}\mathcal{G}$ is in
$\mathcal{A}'_X$ which checks the final condition.

\medskip\noindent
Property (\ref{item-base-change-P}) holds by Lemma \ref{lemma-LC-basic}
and the fact that the base change of a proper map is a proper map (see
Topology, Theorem \ref{topology-theorem-characterize-proper} and
Lemma \ref{topology-lemma-base-change-separated}).

\medskip\noindent
Property (\ref{item-restriction-A}) follows from the commutative
diagram (5) in Lemma \ref{lemma-collect-true-things-Zar}.

\medskip\noindent
Property (\ref{item-A-sheaf}) is Lemma \ref{lemma-describe-pullback-pi}.

\medskip\noindent
Property (\ref{item-A-and-P}) is Lemma \ref{lemma-collect-true-things-Zar}
part (7)(b).

\medskip\noindent
Proof of (\ref{item-refine-tau-by-P}). Suppose given a qc covering
$\{U_i \to U\}$. For $u \in U$ pick $i_1, \ldots, i_m \in I$ and
quasi-compact subsets $E_j \subset U_{i_j}$ such that
$\bigcup f_{i_j}(E_j)$ is a neighbourhood of $u$.
Observe that $Y = \coprod_{j = 1, \ldots, m} E_j \to U$
is proper as a continuous map between Hausdorff quasi-compact spaces
(Topology, Lemma \ref{topology-lemma-closed-map}).
Choose an open neighbourhood $u \in V$ contained in $\bigcup f_{i_j}(E_j)$.
Then $Y \times_U V \to V$ is a surjective proper morphism and
hence a $qc$ covering by Lemma \ref{lemma-proper-surjective-is-qc-covering}.
Since we can do this for every $u \in U$ we see that
(\ref{item-refine-tau-by-P}) holds.
\end{proof}

\begin{lemma}
\label{lemma-V-C-all-n}
With notation as above.
\begin{enumerate}
\item For $X \in \Ob(\textit{LC}_{qc})$ and an abelian sheaf $\mathcal{F}$
on $X$ we have $\epsilon_{X, *}a_X^{-1}\mathcal{F} = \pi_X^{-1}\mathcal{F}$
and $R^i\epsilon_{X, *}(a_X^{-1}\mathcal{F}) = 0$ for $i > 0$.
\item For a proper morphism $f : X \to Y$ in $\textit{LC}_{qc}$
and abelian sheaf $\mathcal{F}$ on $X$ we have
$a_Y^{-1}(R^if_*\mathcal{F}) = R^if_{qc, *}(a_X^{-1}\mathcal{F})$
for all $i$.
\item For $X \in \Ob(\textit{LC}_{qc})$ and $K$ in $D^+(X)$ the map
$\pi_X^{-1}K \to R\epsilon_{X, *}(a_X^{-1}K)$ is an isomorphism.
\item For a proper morphism $f : X \to Y$ in $\textit{LC}_{qc}$
and $K$ in $D^+(X)$ we have $a_Y^{-1}(Rf_*K) = Rf_{qc, *}(a_X^{-1}K)$.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-compare-qc-zar} the lemmas in
Section \ref{section-compare-general} all apply to our current setting.
To translate the results
observe that the category $\mathcal{A}_X$ of Lemma \ref{lemma-A}
is the essential image of
$a_X^{-1} : \textit{Ab}(X) \to \textit{Ab}(\textit{LC}_{qc}/X)$.

\medskip\noindent
Part (1) is equivalent to $(V_n)$ for all $n$ which holds by
Lemma \ref{lemma-V-C-all-n-general}.

\medskip\noindent
Part (2) follows by applying $\epsilon_Y^{-1}$ to the conclusion of
Lemma \ref{lemma-V-implies-C-general}.

\medskip\noindent
Part (3) follows from Lemma \ref{lemma-V-C-all-n-general} part (1)
because $\pi_X^{-1}K$ is in $D^+_{\mathcal{A}'_X}(\textit{LC}_{Zar}/X)$
and $a_X^{-1} = \epsilon_X^{-1} \circ a_X^{-1}$.

\medskip\noindent
Part (4) follows from Lemma \ref{lemma-V-C-all-n-general} part (2)
for the same reason.
\end{proof}

\begin{lemma}
\label{lemma-cohomological-descent-LC}
Let $X$ be an object of $\textit{LC}_{qc}$. For $K \in D^+(X)$ the map
$$
K \longrightarrow Ra_{X, *}a_X^{-1}K
$$
is an isomorphism with $a_X : \Sh(\textit{LC}_{qc}/X) \to \Sh(X)$ as above.
\end{lemma}

\begin{proof}
We first reduce the statement to the case where
$K$ is given by a single abelian sheaf. Namely, represent $K$
by a bounded below complex $\mathcal{F}^\bullet$. By the case of a
sheaf we see that
$\mathcal{F}^n = a_{X, *} a_X^{-1} \mathcal{F}^n$
and that the sheaves $R^qa_{X, *}a_X^{-1}\mathcal{F}^n$
are zero for $q > 0$. By Leray's acyclicity lemma
(Derived Categories, Lemma \ref{derived-lemma-leray-acyclicity})
applied to $a_X^{-1}\mathcal{F}^\bullet$
and the functor $a_{X, *}$ we conclude. From now on assume $K = \mathcal{F}$.

\medskip\noindent
By Lemma \ref{lemma-describe-pullback-pi} we have
$a_{X, *}a_X^{-1}\mathcal{F} = \mathcal{F}$. Thus it suffices to show that
$R^qa_{X, *}a_X^{-1}\mathcal{F} = 0$ for $q > 0$.
For this we can use $a_X = \epsilon_X \circ \pi_X$ and
the Leray spectral sequence Lemma \ref{lemma-relative-Leray}.
By Lemma \ref{lemma-V-C-all-n}
we have $R^i\epsilon_{X, *}(a_X^{-1}\mathcal{F}) = 0$ for $i > 0$
and $\epsilon_{X, *}a_X^{-1}\mathcal{F} = \pi_X^{-1}\mathcal{F}$.
By Lemma \ref{lemma-collect-true-things-Zar} we have
$R^j\pi_{X, *}(\pi_X^{-1}\mathcal{F}) = 0$ for $j > 0$.
This concludes the proof.
\end{proof}

\begin{lemma}
\label{lemma-compare-cohomology-LC}
With $X \in \Ob(\textit{LC}_{qc})$ and
$a_X : \Sh(\textit{LC}_{qc}/X) \to \Sh(X)$ as above:
\begin{enumerate}
\item for an abelian sheaf $\mathcal{F}$ on $X$ we have
$H^n(X, \mathcal{F}) = H^n_{qc}(X, a_X^{-1}\mathcal{F})$,
\item for $K \in D^+(X)$ we have $H^n(X, K) = H^n_{qc}(X, a_X^{-1}K)$.
\end{enumerate}
For example, if $A$ is an abelian group, then we have
$H^n(X, \underline{A}) = H^n_{qc}(X, \underline{A})$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-cohomological-descent-LC}
by Remark \ref{remark-before-Leray}.
\end{proof}











\section{Spectral sequences for Ext}
\label{section-spectral-sequence-ext}

\noindent
In this section we collect various spectral sequences that come up
when considering the Ext functors. For any pair of complexes
$\mathcal{G}^\bullet, \mathcal{F}^\bullet$ of complexes of modules
on a ringed site $(\mathcal{C}, \mathcal{O})$ we denote
$$
\Ext^n_\mathcal{O}(\mathcal{G}^\bullet, \mathcal{F}^\bullet)
=
\Hom_{D(\mathcal{O})}(\mathcal{G}^\bullet, \mathcal{F}^\bullet[n])
$$
according to our general conventions in
Derived Categories, Section \ref{derived-section-ext}.

\begin{example}
\label{example-hom-complex-into-sheaf}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{K}^\bullet$ be a bounded above complex of $\mathcal{O}$-modules.
Let $\mathcal{F}$ be an $\mathcal{O}$-module. Then there is a
spectral sequence with $E_2$-page
$$
E_2^{i, j} =
\Ext_\mathcal{O}^i(H^{-j}(\mathcal{K}^\bullet), \mathcal{F})
\Rightarrow
\Ext_\mathcal{O}^{i + j}(\mathcal{K}^\bullet, \mathcal{F})
$$
and another spectral sequence with $E_1$-page
$$
E_1^{i, j} =
\Ext_\mathcal{O}^j(\mathcal{K}^{-i}, \mathcal{F})
\Rightarrow
\Ext_\mathcal{O}^{i + j}(\mathcal{K}^\bullet, \mathcal{F}).
$$
To construct these spectral sequences choose an injective resolution
$\mathcal{F} \to \mathcal{I}^\bullet$ and consider the two spectral
sequences coming from the double complex
$\Hom_\mathcal{O}(\mathcal{K}^\bullet, \mathcal{I}^\bullet)$, see
Homology, Section \ref{homology-section-double-complex}.
\end{example}








\section{Cup product}
\label{section-cup-product}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$K, M$ be objects of $D(\mathcal{O})$. Set
$A = \Gamma(\mathcal{C}, \mathcal{O})$. The (global) cup product
in this setting is a map
$$
R\Gamma(\mathcal{C}, K) \otimes_A^\mathbf{L}
R\Gamma(\mathcal{C}, M)
\longrightarrow
R\Gamma(\mathcal{C}, K \otimes_\mathcal{O}^\mathbf{L} M)
$$
in $D(A)$. We define it as the relative cup product for
the morphism of ringed topoi
$(\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(pt), A)$
as in Remark \ref{remark-cup-product}.

\medskip\noindent
Let us formulate and prove a natural compatibility of the
relative cup product. Namely, suppose that we have a morphism
$f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ of ringed topoi.
Let $\mathcal{K}^\bullet$ and $\mathcal{M}^\bullet$
be complexes of $\mathcal{O}_\mathcal{C}$-modules.
There is a naive cup product
$$
\text{Tot}(
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
f_*\mathcal{M}^\bullet)
\longrightarrow
f_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
$$
We claim that this is related to the relative cup product.

\begin{lemma}
\label{lemma-cup-compatible-with-naive}
In the situation above the following diagram commutes
$$
\xymatrix{
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f_*\mathcal{M}^\bullet \ar[r] \ar[d]
&
Rf_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
Rf_*\mathcal{M}^\bullet \ar[d]^{\text{Remark \ref{remark-cup-product}}} \\
\text{Tot}(
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
f_*\mathcal{M}^\bullet) \ar[d]_{\text{naive cup product}} &
Rf_*(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L}
\mathcal{M}^\bullet) \ar[d] \\
f_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet) \ar[r] &
Rf_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
}
$$
\end{lemma}

\begin{proof}
By the construction in Remark \ref{remark-cup-product} we see that
going around the diagram clockwise the map
$$
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f_*\mathcal{M}^\bullet 
\longrightarrow
Rf_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
$$
is adjoint to the map
\begin{align*}
Lf^*(f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f_*\mathcal{M}^\bullet)
& =
Lf^*f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
Lf^*f_*\mathcal{M}^\bullet \\
& \to
Lf^*Rf_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
Lf^*Rf_*\mathcal{M}^\bullet \\
& \to
\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
\mathcal{M}^\bullet \\
& \to
\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
\end{align*}
By Lemma \ref{lemma-adjoints-push-pull-compatibility} this is also equal to
\begin{align*}
Lf^*(f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f_*\mathcal{M}^\bullet)
& =
Lf^*f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
Lf^*f_*\mathcal{M}^\bullet \\
& \to
f^*f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f^*f_*\mathcal{M}^\bullet \\
& \to
\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
\mathcal{M}^\bullet \\
& \to
\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
\end{align*}
Going around anti-clockwise we obtain the map adjoint to the map
\begin{align*}
Lf^*(f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f_*\mathcal{M}^\bullet)
& \to
Lf^*\text{Tot}(
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
f_*\mathcal{M}^\bullet) \\
& \to
Lf^*f_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet) \\
& \to
Lf^*Rf_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet) \\
& \to
\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
\end{align*}
By Lemma \ref{lemma-adjoints-push-pull-compatibility} this is also equal to
\begin{align*}
Lf^*(f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f_*\mathcal{M}^\bullet)
& \to
Lf^*\text{Tot}(
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
f_*\mathcal{M}^\bullet) \\
& \to
Lf^*f_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet) \\
& \to
f^*f_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet) \\
& \to
\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
\end{align*}
Now the proof is finished by a contemplation of the diagram
$$
\xymatrix{
Lf^*(f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L}
f_*\mathcal{M}^\bullet) \ar[d] \ar[rr] & &
Lf^*f_*\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L}
Lf^*f_*\mathcal{M}^\bullet \ar[d] \\
Lf^*\text{Tot}(
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
f_*\mathcal{M}^\bullet) \ar[d]_{naive} \ar[r] &
f^*\text{Tot}(
f_*\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{D}}
f_*\mathcal{M}^\bullet) \ar[ldd]^{naive} \ar[dd] &
f^*f_*\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L}
f^*f_*\mathcal{M}^\bullet \ar[dd] \ar[ldd] \\
Lf^*f_*\text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet) \ar[d] \\
f^*f_*\text{Tot}(\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet) \ar[rd] &
\text{Tot}(f^*f_*\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}
f^*f_*\mathcal{M}^\bullet) \ar[d] &
\mathcal{K}^\bullet \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L}
\mathcal{M}^\bullet \ar[ld] \\
& \text{Tot}(\mathcal{K}^\bullet
\otimes_{\mathcal{O}_\mathcal{C}}
\mathcal{M}^\bullet)
}
$$
All of the polygons in this diagram commute. The top one commutes
by Lemma \ref{lemma-tensor-pull-compatibility}.
The square with the two naive cup products commutes because
$Lf^* \to f^*$ is functorial in the complex of modules.
Similarly with the square involving the two maps
$\mathcal{A}^\bullet \otimes^\mathbf{L} \mathcal{B}^\bullet \to
\text{Tot}(\mathcal{A}^\bullet \otimes \mathcal{B}^\bullet)$.
Finally, the commutativity of the remaining square
is true on the level of complexes and may be viewed as the
definiton of the naive cup product (by the adjointness
of $f^*$ and $f_*$). The proof is finished because
going around the diagram on the outside are the two maps
given above.
\end{proof}

\begin{lemma}
\label{lemma-cup-product-associative}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. The relative cup product of
Remark \ref{remark-cup-product} is associative in the sense that
the diagram
$$
\xymatrix{
Rf_*K \otimes_{\mathcal{O}'}^\mathbf{L}
Rf_*L \otimes_{\mathcal{O}'}^\mathbf{L}
Rf_*M \ar[r] \ar[d] &
Rf_*(K \otimes_\mathcal{O}^\mathbf{L} L)
\otimes_{\mathcal{O}'}^\mathbf{L} Rf_*M \ar[d] \\
Rf_*K \otimes_{\mathcal{O}'}^\mathbf{L}
Rf_*(L \otimes_\mathcal{O}^\mathbf{L} M) \ar[r] &
Rf_*(K \otimes_\mathcal{O}^\mathbf{L} 
L \otimes_\mathcal{O}^\mathbf{L} M)
}
$$
is commutative in $D(\mathcal{O}')$ for all $K, L, M$ in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
Going around either side we obtain the map adjoint to the obvious map
\begin{align*}
Lf^*(Rf_*K \otimes_{\mathcal{O}'}^\mathbf{L}
Rf_*L \otimes_{\mathcal{O}'}^\mathbf{L}
Rf_*M) & =
Lf^*(Rf_*K) \otimes_\mathcal{O}^\mathbf{L}
Lf^*(Rf_*L) \otimes_\mathcal{O}^\mathbf{L}
Lf^*(Rf_*M) \\
& \to
K \otimes_\mathcal{O}^\mathbf{L} 
L \otimes_\mathcal{O}^\mathbf{L} M
\end{align*}
in $D(\mathcal{O})$.
\end{proof}

\begin{lemma}
\label{lemma-cup-product-commutative}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. The relative cup product of
Remark \ref{remark-cup-product} is commutative in the sense that
the diagram
$$
\xymatrix{
Rf_*K \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*L \ar[r] \ar[d]_\psi &
Rf_*(K \otimes_\mathcal{O}^\mathbf{L} L) \ar[d]^{Rf_*\psi} \\
Rf_*L \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*K \ar[r] &
Rf_*(L \otimes_\mathcal{O}^\mathbf{L} K)
}
$$
is commutative in $D(\mathcal{O}')$ for all $K, L$ in $D(\mathcal{O})$.
Here $\psi$ is the commutativity constraint on the derived category
(Lemma \ref{lemma-symmetric-monoidal-derived}).
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-compose-cup-product}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
and $f' : (\Sh(\mathcal{C}'), \mathcal{O}') \to
(\Sh(\mathcal{C}''), \mathcal{O}'')$
be morphisms of ringed topoi. The relative cup product of
Remark \ref{remark-cup-product} is compatible with compositions
in the sense that the diagram
$$
\xymatrix{
R(f' \circ f)_*K \otimes_{\mathcal{O}''}^\mathbf{L} R(f' \circ f)_*L
\ar@{=}[rr] \ar[d] & &
Rf'_*Rf_*K \otimes_{\mathcal{O}''}^\mathbf{L} Rf'_*Rf_*L \ar[d] \\
R(f' \circ f)_*(K \otimes_\mathcal{O}^\mathbf{L} L) \ar@{=}[r] &
Rf'_*Rf_*(K \otimes_\mathcal{O}^\mathbf{L} L) &
Rf'_*(Rf_*K \otimes_{\mathcal{O}'}^\mathbf{L}  Rf_*L) \ar[l]
}
$$
is commutative in $D(\mathcal{O}'')$ for all $K, L$ in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
This is true because going around the diagram either way we obtain the map
adjoint to the map
\begin{align*}
& L(f' \circ f)^*\left(R(f' \circ f)_*K
\otimes_{\mathcal{O}''}^\mathbf{L}
R(f' \circ f)_*L\right) \\
& =
L(f' \circ f)^*R(f' \circ f)_*K
\otimes_\mathcal{O}^\mathbf{L}
L(f' \circ f)^*R(f' \circ f)_*L) \\
& \to
K \otimes_\mathcal{O}^\mathbf{L} L
\end{align*}
in $D(\mathcal{O})$. To see this one uses that the composition
of the counits like so
$$
L(f' \circ f)^*R(f' \circ f)_* =
Lf^* L(f')^* Rf'_* Rf_*  \to
Lf^* Rf_* \to \text{id}
$$
is the counit for $L(f' \circ f)^*$ and $R(f' \circ f)_*$. See
Categories, Lemma \ref{categories-lemma-compose-counits}.
\end{proof}







\section{Hom complexes}
\label{section-hom-complexes}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{L}^\bullet$ and $\mathcal{M}^\bullet$ be two complexes
of $\mathcal{O}$-modules. We construct a complex
of $\mathcal{O}$-modules
$\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{M}^\bullet)$.
Namely, for each $n$ we set
$$
\SheafHom^n(\mathcal{L}^\bullet, \mathcal{M}^\bullet) =
\prod\nolimits_{n = p + q}
\SheafHom_\mathcal{O}(\mathcal{L}^{-q}, \mathcal{M}^p)
$$
It is a good idea to think of $\SheafHom^n$ as the
sheaf of $\mathcal{O}$-modules of all $\mathcal{O}$-linear
maps from $\mathcal{L}^\bullet$ to $\mathcal{M}^\bullet$
(viewed as graded $\mathcal{O}$-modules) which are homogenous
of degree $n$. In this terminology, we define the differential by the rule
$$
\text{d}(f) =
\text{d}_\mathcal{M} \circ f - (-1)^n f \circ \text{d}_\mathcal{L}
$$
for
$f \in \SheafHom^n_\mathcal{O}(\mathcal{L}^\bullet, \mathcal{M}^\bullet)$.
We omit the verification that $\text{d}^2 = 0$.
This construction is a special case of
Differential Graded Algebra, Example \ref{dga-example-category-complexes}.
It follows immediately from the construction that we have
\begin{equation}
\label{equation-cohomology-hom-complex}
H^n(\Gamma(U, \SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{M}^\bullet))) =
\Hom_{K(\mathcal{O}_U)}(\mathcal{L}^\bullet|_U, \mathcal{M}^\bullet[n]|_U)
\end{equation}
for all $n \in \mathbf{Z}$ and every $U \in \Ob(\mathcal{C})$. Similarly,
we have
\begin{equation}
\label{equation-global-cohomology-hom-complex}
H^n(\Gamma(\mathcal{C},
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{M}^\bullet))) =
\Hom_{K(\mathcal{O})}(\mathcal{L}^\bullet, \mathcal{M}^\bullet[n])
\end{equation}
for the complex of global sections.

\begin{lemma}
\label{lemma-compose}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Given complexes $\mathcal{K}^\bullet, \mathcal{L}^\bullet, \mathcal{M}^\bullet$
of $\mathcal{O}$-modules there is an isomorphism
$$
\SheafHom^\bullet(\mathcal{K}^\bullet,
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{M}^\bullet))
=
\SheafHom^\bullet(\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O}
\mathcal{L}^\bullet), \mathcal{M}^\bullet)
$$
of complexes of $\mathcal{O}$-modules functorial in
$\mathcal{K}^\bullet, \mathcal{L}^\bullet, \mathcal{M}^\bullet$.
\end{lemma}

\begin{proof}
Omitted. Hint: This is proved in exactly the same way as
More on Algebra, Lemma \ref{more-algebra-lemma-compose}.
\end{proof}

\begin{lemma}
\label{lemma-composition}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Given complexes
$\mathcal{K}^\bullet, \mathcal{L}^\bullet, \mathcal{M}^\bullet$
of $\mathcal{O}$-modules there is a canonical morphism
$$
\text{Tot}\left(
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{M}^\bullet)
\otimes_\mathcal{O}
\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{L}^\bullet)
\right)
\longrightarrow
\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{M}^\bullet)
$$
of complexes of $\mathcal{O}$-modules.
\end{lemma}

\begin{proof}
Omitted. Hint: This is proved in exactly the same way as
More on Algebra, Lemma \ref{more-algebra-lemma-composition}.
\end{proof}

\begin{lemma}
\label{lemma-diagonal-better}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Given complexes
$\mathcal{K}^\bullet, \mathcal{L}^\bullet, \mathcal{M}^\bullet$
of $\mathcal{O}$-modules there is a canonical morphism
$$
\text{Tot}\left(
\mathcal{K}^\bullet \otimes_\mathcal{O}
\SheafHom^\bullet(\mathcal{M}^\bullet, \mathcal{L}^\bullet)
\right)
\longrightarrow
\SheafHom^\bullet(\mathcal{M}^\bullet,
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet))
$$
of complexes of $\mathcal{O}$-modules functorial in all three complexes.
\end{lemma}

\begin{proof}
Omitted. Hint: This is proved in exactly the same way as
More on Algebra, Lemma \ref{more-algebra-lemma-diagonal-better}.
\end{proof}

\begin{lemma}
\label{lemma-diagonal}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Given complexes
$\mathcal{K}^\bullet, \mathcal{L}^\bullet, \mathcal{M}^\bullet$
of $\mathcal{O}$-modules there is a canonical morphism
$$
\mathcal{K}^\bullet
\longrightarrow
\SheafHom^\bullet(\mathcal{L}^\bullet,
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet))
$$
of complexes of $\mathcal{O}$-modules functorial in both complexes.
\end{lemma}

\begin{proof}
Omitted. Hint: This is proved in exactly the same way as
More on Algebra, Lemma \ref{more-algebra-lemma-diagonal}.
\end{proof}

\begin{lemma}
\label{lemma-evaluate-and-more}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Given complexes
$\mathcal{K}^\bullet, \mathcal{L}^\bullet, \mathcal{M}^\bullet$
of $\mathcal{O}$-modules there is a canonical morphism
$$
\text{Tot}(\SheafHom^\bullet(\mathcal{L}^\bullet,
\mathcal{M}^\bullet) \otimes_\mathcal{O} \mathcal{K}^\bullet)
\longrightarrow
\SheafHom^\bullet(\SheafHom^\bullet(\mathcal{K}^\bullet,
\mathcal{L}^\bullet), \mathcal{M}^\bullet)
$$
of complexes of $\mathcal{O}$-modules functorial in all three complexes.
\end{lemma}

\begin{proof}
Omitted. Hint: This is proved in exactly the same way as
More on Algebra, Lemma \ref{more-algebra-lemma-evaluate-and-more}.
\end{proof}

\begin{lemma}
\label{lemma-RHom-into-K-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $L$ and $M$
be objects of $D(\mathcal{O})$. Let $\mathcal{I}^\bullet$
be a K-injective complex of $\mathcal{O}$-modules representing $M$. Let
$\mathcal{L}^\bullet$ be a complex of $\mathcal{O}$-modules
representing $L$.
Then
$$
H^0(\Gamma(U, \SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet))) =
\Hom_{D(\mathcal{O}_U)}(L|_U, M|_U)
$$
for all $U \in \Ob(\mathcal{C})$. Similarly,
$H^0(\Gamma(\mathcal{C},
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet))) =
\Hom_{D(\mathcal{O})}(L, M)$.
\end{lemma}

\begin{proof}
We have
\begin{align*}
H^0(\Gamma(U, \SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet)))
& =
\Hom_{K(\mathcal{O}_U)}(L|_U, M|_U) \\
& =
\Hom_{D(\mathcal{O}_U)}(L|_U, M|_U)
\end{align*}
The first equality is (\ref{equation-cohomology-hom-complex}).
The second equality is true because $\mathcal{I}^\bullet|_U$
is K-injective by Lemma \ref{lemma-restrict-K-injective-to-open}.
The proof of the last equation is similar except that it uses
(\ref{equation-global-cohomology-hom-complex}).
\end{proof}

\begin{lemma}
\label{lemma-RHom-well-defined}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{I}')^\bullet \to \mathcal{I}^\bullet$
be a quasi-isomorphism of K-injective complexes of $\mathcal{O}$-modules.
Let $(\mathcal{L}')^\bullet \to \mathcal{L}^\bullet$
be a quasi-isomorphism of complexes of $\mathcal{O}$-modules.
Then
$$
\SheafHom^\bullet(\mathcal{L}^\bullet, (\mathcal{I}')^\bullet)
\longrightarrow
\SheafHom^\bullet((\mathcal{L}')^\bullet, \mathcal{I}^\bullet)
$$
is a quasi-isomorphism.
\end{lemma}

\begin{proof}
Let $M$ be the object of $D(\mathcal{O})$ represented by
$\mathcal{I}^\bullet$ and $(\mathcal{I}')^\bullet$.
Let $L$ be the object of $D(\mathcal{O})$ represented by
$\mathcal{L}^\bullet$ and $(\mathcal{L}')^\bullet$.
By Lemma \ref{lemma-RHom-into-K-injective}
we see that the sheaves
$$
H^0(\SheafHom^\bullet(\mathcal{L}^\bullet, (\mathcal{I}')^\bullet))
\quad\text{and}\quad
H^0(\SheafHom^\bullet((\mathcal{L}')^\bullet, \mathcal{I}^\bullet))
$$
are both equal to the sheaf associated to the presheaf
$$
U \longmapsto \Hom_{D(\mathcal{O}_U)}(L|_U, M|_U)
$$
Thus the map is a quasi-isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-RHom-from-K-flat-into-K-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{I}^\bullet$
be a K-injective complex of $\mathcal{O}$-modules. Let
$\mathcal{L}^\bullet$ be a K-flat complex of $\mathcal{O}$-modules.
Then $\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet)$
is a K-injective complex of $\mathcal{O}$-modules.
\end{lemma}

\begin{proof}
Namely, if $\mathcal{K}^\bullet$ is an acyclic complex of
$\mathcal{O}$-modules, then
\begin{align*}
\Hom_{K(\mathcal{O})}(\mathcal{K}^\bullet,
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet))
& =
H^0(\Gamma(\mathcal{C},
\SheafHom^\bullet(\mathcal{K}^\bullet,
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet)))) \\
& =
H^0(\Gamma(\mathcal{C}, \SheafHom^\bullet(\text{Tot}(
\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet),
\mathcal{I}^\bullet))) \\
& =
\Hom_{K(\mathcal{O})}(
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet),
\mathcal{I}^\bullet) \\
& =
0
\end{align*}
The first equality by (\ref{equation-global-cohomology-hom-complex}).
The second equality by Lemma \ref{lemma-compose}.
The third equality by (\ref{equation-global-cohomology-hom-complex}).
The final equality because
$\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet)$
is acyclic because $\mathcal{L}^\bullet$ is K-flat
(Definition \ref{definition-K-flat}) and because $\mathcal{I}^\bullet$
is K-injective.
\end{proof}








\section{Internal hom in the derived category}
\label{section-internal-hom}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $L, M$ be objects
of $D(\mathcal{O})$. We would like to construct an object
$R\SheafHom(L, M)$ of $D(\mathcal{O})$ such that for every third
object $K$ of $D(\mathcal{O})$ there exists a canonical bijection
\begin{equation}
\label{equation-internal-hom}
\Hom_{D(\mathcal{O})}(K, R\SheafHom(L, M))
=
\Hom_{D(\mathcal{O})}(K \otimes_\mathcal{O}^\mathbf{L} L, M)
\end{equation}
Observe that this formula defines $R\SheafHom(L, M)$ up to unique
isomorphism by the Yoneda lemma
(Categories, Lemma \ref{categories-lemma-yoneda}).

\medskip\noindent
To construct such an object, choose a K-injective complex of
$\mathcal{O}$-modules $\mathcal{I}^\bullet$ representing $M$ and any
complex of $\mathcal{O}$-modules $\mathcal{L}^\bullet$ representing $L$.
Then we set
Then we set
$$
R\SheafHom(L, M) = \SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet)
$$
where the right hand side is the complex of $\mathcal{O}$-modules
constructed in Section \ref{section-hom-complexes}.
This is well defined by Lemma \ref{lemma-RHom-well-defined}.
We get a functor
$$
D(\mathcal{O})^{opp} \times D(\mathcal{O}) \longrightarrow D(\mathcal{O}),
\quad
(K, L) \longmapsto R\SheafHom(K, L)
$$
As a prelude to proving (\ref{equation-internal-hom})
we compute the cohomology groups of $R\SheafHom(K, L)$.

\begin{lemma}
\label{lemma-section-RHom-over-U}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K, L$ be objects
of $D(\mathcal{O})$. For every object $U$ of $\mathcal{C}$ we have
$$
H^0(U, R\SheafHom(L, M)) =
\Hom_{D(\mathcal{O}_U)}(L|_U, M|_U)
$$
and we have $H^0(\mathcal{C}, R\SheafHom(L, M)) =
\Hom_{D(\mathcal{O})}(L, M)$.
\end{lemma}

\begin{proof}
Choose a K-injective complex $\mathcal{I}^\bullet$ of
$\mathcal{O}$-modules representing $M$ and a K-flat complex
$\mathcal{L}^\bullet$ representing $L$. Then
$\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet)$
is K-injective by Lemma \ref{lemma-RHom-from-K-flat-into-K-injective}.
Hence we can compute cohomology over $U$ by simply taking sections over $U$
and the result follows from Lemma \ref{lemma-RHom-into-K-injective}.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K, L, M$ be objects
of $D(\mathcal{O})$. With the construction as described above
there is a canonical isomorphism
$$
R\SheafHom(K, R\SheafHom(L, M)) =
R\SheafHom(K \otimes_\mathcal{O}^\mathbf{L} L, M)
$$
in $D(\mathcal{O})$ functorial in $K, L, M$
which recovers (\ref{equation-internal-hom}) on taking $H^0(\mathcal{C}, -)$.
\end{lemma}

\begin{proof}
Choose a K-injective complex $\mathcal{I}^\bullet$ representing
$M$ and a K-flat complex of $\mathcal{O}$-modules $\mathcal{L}^\bullet$
representing $L$.
For any complex of $\mathcal{O}$-modules $\mathcal{K}^\bullet$
we have
$$
\SheafHom^\bullet(\mathcal{K}^\bullet,
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{I}^\bullet))
=
\SheafHom^\bullet(
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet),
\mathcal{I}^\bullet)
$$
by Lemma \ref{lemma-compose}.
Note that the left hand side represents
$R\SheafHom(K, R\SheafHom(L, M))$ (use
Lemma \ref{lemma-RHom-from-K-flat-into-K-injective})
and that the right hand side represents
$R\SheafHom(K \otimes_\mathcal{O}^\mathbf{L} L, M)$.
This proves the displayed formula of the lemma.
Taking global sections and using Lemma \ref{lemma-section-RHom-over-U}
we obtain (\ref{equation-internal-hom}).
\end{proof}

\begin{lemma}
\label{lemma-restriction-RHom-to-U}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K, L$ be objects
of $D(\mathcal{O})$. The construction of $R\SheafHom(K, L)$
commutes with restrictions, i.e.,
for every object $U$ of $\mathcal{C}$ we have
$R\SheafHom(K|_U, L|_U) = R\SheafHom(K, L)|_U$.
\end{lemma}

\begin{proof}
This is clear from the construction and
Lemma \ref{lemma-restrict-K-injective-to-open}.
\end{proof}

\begin{lemma}
\label{lemma-RHom-triangulated}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. The bifunctor
$R\SheafHom(- , -)$ transforms distinguished triangles into
distinguished triangles in both variables.
\end{lemma}

\begin{proof}
This follows from the observation that the assignment
$$
(\mathcal{L}^\bullet, \mathcal{M}^\bullet) \longmapsto
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{M}^\bullet)
$$
transforms a termwise split short exact sequences of complexes in either
variable into a termwise split short exact sequence. Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-evaluate}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K, L, M$ be objects of
$D(\mathcal{O})$. There is a canonical morphism
$$
R\SheafHom(L, M) \otimes_\mathcal{O}^\mathbf{L} K
\longrightarrow
R\SheafHom(R\SheafHom(K, L), M)
$$
in $D(\mathcal{O})$ functorial in $K, L, M$.
\end{lemma}

\begin{proof}
Choose
a K-injective complex $\mathcal{I}^\bullet$ representing $M$,
a K-injective complex $\mathcal{J}^\bullet$ representing $L$, and
a K-flat complex $\mathcal{K}^\bullet$ representing $K$.
The map is defined using the map
$$
\text{Tot}(\SheafHom^\bullet(\mathcal{J}^\bullet,
\mathcal{I}^\bullet) \otimes_\mathcal{O} \mathcal{K}^\bullet)
\longrightarrow
\SheafHom^\bullet(\SheafHom^\bullet(\mathcal{K}^\bullet,
\mathcal{J}^\bullet), \mathcal{I}^\bullet)
$$
of Lemma \ref{lemma-evaluate-and-more}. By our particular
choice of complexes the left hand side represents
$R\SheafHom(L, M) \otimes_\mathcal{O}^\mathbf{L} K$
and the right hand side represents
$R\SheafHom(R\SheafHom(K, L), M)$. We omit the proof that
this is functorial in all three objects of $D(\mathcal{O})$.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-composition}
\begin{slogan}
Composition on RSheafHom.
\end{slogan}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Given $K, L, M$ in
$D(\mathcal{O})$ there is a canonical morphism
$$
R\SheafHom(L, M) \otimes_\mathcal{O}^\mathbf{L} R\SheafHom(K, L)
\longrightarrow R\SheafHom(K, M)
$$
in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
Choose a K-injective complex $\mathcal{I}^\bullet$ representing $M$,
a K-injective complex $\mathcal{J}^\bullet$ representing $L$, and
any complex of $\mathcal{O}$-modules $\mathcal{K}^\bullet$ representing $K$.
By Lemma \ref{lemma-composition} there is a map of complexes
$$
\text{Tot}\left(
\SheafHom^\bullet(\mathcal{J}^\bullet, \mathcal{I}^\bullet)
\otimes_\mathcal{O}
\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{J}^\bullet)
\right)
\longrightarrow
\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{I}^\bullet)
$$
The complexes of $\mathcal{O}$-modules
$\SheafHom^\bullet(\mathcal{J}^\bullet, \mathcal{I}^\bullet)$,
$\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{J}^\bullet)$, and
$\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{I}^\bullet)$
represent $R\SheafHom(L, M)$, $R\SheafHom(K, L)$, and $R\SheafHom(K, M)$.
If we choose a K-flat complex $\mathcal{H}^\bullet$ and a quasi-isomorphism
$\mathcal{H}^\bullet \to
\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{J}^\bullet)$,
then there is a map
$$
\text{Tot}\left(
\SheafHom^\bullet(\mathcal{J}^\bullet, \mathcal{I}^\bullet)
\otimes_\mathcal{O} \mathcal{H}^\bullet
\right)
\longrightarrow
\text{Tot}\left(
\SheafHom^\bullet(\mathcal{J}^\bullet, \mathcal{I}^\bullet)
\otimes_\mathcal{O}
\SheafHom^\bullet(\mathcal{K}^\bullet, \mathcal{J}^\bullet)
\right)
$$
whose source represents
$R\SheafHom(L, M) \otimes_\mathcal{O}^\mathbf{L} R\SheafHom(K, L)$.
Composing the two displayed arrows gives the desired map. We omit the
proof that the construction is functorial.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-diagonal-better}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Given $K, L, M$
in $D(\mathcal{O})$ there is a canonical morphism
$$
K \otimes_\mathcal{O}^\mathbf{L} R\SheafHom(M, L)
\longrightarrow
R\SheafHom(M, K \otimes_\mathcal{O}^\mathbf{L} L)
$$
in $D(\mathcal{O})$ functorial in $K, L, M$.
\end{lemma}

\begin{proof}
Choose a K-flat complex $\mathcal{K}^\bullet$ representing $K$,
and a K-injective complex $\mathcal{I}^\bullet$ representing $L$, and
choose any complex of $\mathcal{O}$-modules $\mathcal{M}^\bullet$
representing $M$. Choose a quasi-isomorphism
$\text{Tot}(\mathcal{K}^\bullet \otimes_{\mathcal{O}_X} \mathcal{I}^\bullet)
\to \mathcal{J}^\bullet$
where $\mathcal{J}^\bullet$ is K-injective. Then we use the map
$$
\text{Tot}\left(
\mathcal{K}^\bullet \otimes_\mathcal{O}
\SheafHom^\bullet(\mathcal{M}^\bullet, \mathcal{I}^\bullet)
\right)
\to
\SheafHom^\bullet(\mathcal{M}^\bullet,
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{I}^\bullet))
\to
\SheafHom^\bullet(\mathcal{M}^\bullet, \mathcal{J}^\bullet)
$$
where the first map is the map from Lemma \ref{lemma-diagonal-better}.
\end{proof}

\begin{lemma}
\label{lemma-internal-hom-diagonal}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Given $K, L$ in $D(\mathcal{O})$ there is a canonical morphism
$$
K \longrightarrow R\SheafHom(L, K \otimes_\mathcal{O}^\mathbf{L} L)
$$
in $D(\mathcal{O})$ functorial in both $K$ and $L$.
\end{lemma}

\begin{proof}
Choose a K-flat complex $\mathcal{K}^\bullet$ representing $K$
and any complex of $\mathcal{O}$-modules $\mathcal{L}^\bullet$
representing $L$. Choose a K-injective complex $\mathcal{J}^\bullet$
and a quasi-isomorphism
$\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet)
\to \mathcal{J}^\bullet$. Then we use
$$
\mathcal{K}^\bullet \to
\SheafHom^\bullet(\mathcal{L}^\bullet,
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet))
\to
\SheafHom^\bullet(\mathcal{L}^\bullet, \mathcal{J}^\bullet)
$$
where the first map comes from Lemma \ref{lemma-diagonal}.
\end{proof}

\begin{lemma}
\label{lemma-dual}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $L$ be an
object of $D(\mathcal{O})$. Set $L^\vee = R\SheafHom(L, \mathcal{O})$.
For $M$ in $D(\mathcal{O})$ there is a canonical map
\begin{equation}
\label{equation-eval}
M \otimes^\mathbf{L}_\mathcal{O} L^\vee \longrightarrow R\SheafHom(L, M)
\end{equation}
which induces a canonical map
$$
H^0(\mathcal{C}, M \otimes_\mathcal{O}^\mathbf{L} L^\vee)
\longrightarrow
\Hom_{D(\mathcal{O})}(L, M)
$$
functorial in $M$ in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
The map (\ref{equation-eval}) is a special case of
Lemma \ref{lemma-internal-hom-composition}
using the identification $M = R\SheafHom(\mathcal{O}, M)$.
\end{proof}

\begin{remark}
\label{remark-projection-formula-for-internal-hom}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $K, L$ be objects of $D(\mathcal{O}_\mathcal{C})$. We claim there is
a canonical map
$$
Rf_*R\SheafHom(L, K) \longrightarrow R\SheafHom(Rf_*L, Rf_*K)
$$
Namely, by (\ref{equation-internal-hom}) this is the same thing
as a map
$Rf_*R\SheafHom(L, K) \otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L} Rf_*L
\to Rf_*K$.
For this we can use the composition
$$
Rf_*R\SheafHom(L, K) \otimes_{\mathcal{O}_\mathcal{D}}^\mathbf{L} Rf_*L \to
Rf_*(R\SheafHom(L, K) \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L} L) \to
Rf_*K
$$
where the first arrow is the relative cup product
(Remark \ref{remark-cup-product}) and the second arrow is $Rf_*$ applied
to the canonical map
$R\SheafHom(L, K) \otimes_{\mathcal{O}_\mathcal{C}}^\mathbf{L} L \to K$
coming from Lemma \ref{lemma-internal-hom-composition}
(with $\mathcal{O}_\mathcal{C}$ in one of the spots).
\end{remark}

\begin{remark}
\label{remark-prepare-fancy-base-change}
Let $h : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\mathcal{C}'), \mathcal{O}')$
be a morphism of ringed topoi. Let $K, L$ be objects of $D(\mathcal{O}')$.
We claim there is a canonical map
$$
Lh^*R\SheafHom(K, L) \longrightarrow R\SheafHom(Lh^*K, Lh^*L)
$$
in $D(\mathcal{O})$. Namely, by (\ref{equation-internal-hom})
proved in Lemma \ref{lemma-internal-hom}
such a map is the same thing as a map
$$
Lh^*R\SheafHom(K, L) \otimes^\mathbf{L} Lh^*K \longrightarrow Lh^*L
$$
The source of this arrow is $Lh^*(\SheafHom(K, L) \otimes^\mathbf{L} K)$
by Lemma \ref{lemma-pullback-tensor-product}
hence it suffices to construct a canonical map
$$
R\SheafHom(K, L) \otimes^\mathbf{L} K \longrightarrow L.
$$
For this we take the arrow corresponding to
$$
\text{id} :
R\SheafHom(K, L)
\longrightarrow
R\SheafHom(K, L)
$$
via (\ref{equation-internal-hom}).
\end{remark}

\begin{remark}
\label{remark-fancy-base-change}
Suppose that
$$
\xymatrix{
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'})
\ar[r]_h \ar[d]_{f'} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^f \\
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'})
\ar[r]^g &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
is a commutative diagram of ringed topoi. Let $K, L$ be objects
of $D(\mathcal{O}_\mathcal{C})$. We claim there exists a canonical base change
map
$$
Lg^*Rf_*R\SheafHom(K, L)
\longrightarrow
R(f')_*R\SheafHom(Lh^*K, Lh^*L)
$$
in $D(\mathcal{O}_{\mathcal{D}'})$. Namely, we take the map adjoint to
the composition
\begin{align*}
L(f')^*Lg^*Rf_*R\SheafHom(K, L)
& =
Lh^*Lf^*Rf_*R\SheafHom(K, L) \\
& \to
Lh^*R\SheafHom(K, L) \\
& \to
R\SheafHom(Lh^*K, Lh^*L)
\end{align*}
where the first arrow uses the adjunction mapping
$Lf^*Rf_* \to \text{id}$ and the second arrow is the canonical map
constructed in Remark \ref{remark-prepare-fancy-base-change}.
\end{remark}




\section{Global derived hom}
\label{section-global-RHom}

\noindent
Let $(\Sh(\mathcal{C}), \mathcal{O})$ be a ringed topos.
Let $K, L \in D(\mathcal{O})$.
Using the construction of the internal hom in the derived category we
obtain a well defined object
$$
R\Hom_\mathcal{O}(K, L) = R\Gamma(X, R\SheafHom(K, L))
$$
in $D(\Gamma(\mathcal{C}, \mathcal{O}))$. By
Lemma \ref{lemma-section-RHom-over-U} we have
$$
H^0(R\Hom_\mathcal{O}(K, L)) = \Hom_{D(\mathcal{O})}(K, L)
$$
and
$$
H^p(R\Hom_\mathcal{O}(K, L)) = \Ext_{D(\mathcal{O})}^p(K, L)
$$
If $f : (\mathcal{C}', \mathcal{O}') \to (\mathcal{C}, \mathcal{O})$
is a morphism of ringed topoi, then there is a canonical map
$$
R\Hom_\mathcal{O}(K, L) \longrightarrow R\Hom_{\mathcal{O}'}(Lf^*K, Lf^*L)
$$
in $D(\Gamma(\mathcal{O}))$ by taking global sections of the map
defined in Remark \ref{remark-prepare-fancy-base-change}.









\section{Derived lower shriek}
\label{section-derived-lower-shriek}

\noindent
In this section we study morphisms $g$ of ringed topoi where besides
$Lg^*$ and $Rg_*$ there also exists a derived functor $Lg_!$.

\begin{lemma}
\label{lemma-pullback-injective-pre-limp}
Let $u : \mathcal{C} \to \mathcal{D}$ be a continuous and cocontinuous
functor of sites. Let $g : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$
be the corresponding morphism of topoi. Let $\mathcal{O}_\mathcal{D}$
be a sheaf of rings and let $\mathcal{I}$ be an injective
$\mathcal{O}_\mathcal{D}$-module. Then
$H^p(U, g^{-1}\mathcal{I}) = 0$ for all $p > 0$ and $U \in \Ob(\mathcal{C})$.
\end{lemma}

\begin{proof}
The vanishing of the lemma follows from
Lemma \ref{lemma-cech-vanish-collection}
if we can prove vanishing of all higher
{\v C}ech cohomology groups
$\check H^p(\mathcal{U}, g^{-1}\mathcal{I})$
for any covering $\mathcal{U} = \{U_i \to U\}$ of $\mathcal{C}$.
Since $u$ is continuous, $u(\mathcal{U}) = \{u(U_i) \to u(U)\}$
is a covering of $\mathcal{D}$, and
$u(U_{i_0} \times_U \ldots \times_U U_{i_n}) =
u(U_{i_0}) \times_{u(U)} \ldots \times_{u(U)} u(U_{i_n})$.
Thus we have
$$
\check H^p(\mathcal{U}, g^{-1}\mathcal{I}) =
\check H^p(u(\mathcal{U}), \mathcal{I})
$$
because $g^{-1} = u^p$ by Sites, Lemma \ref{sites-lemma-when-shriek}.
Since $\mathcal{I}$ is an injective
$\mathcal{O}_\mathcal{D}$-module these {\v C}ech cohomology groups vanish, see
Lemma \ref{lemma-injective-module-trivial-cech}.
\end{proof}

\begin{lemma}
\label{lemma-existence-derived-lower-shriek}
Let $u : \mathcal{C} \to \mathcal{D}$ be a continuous and cocontinuous
functor of sites. Let $g : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$ be the
corresponding morphism of topoi. Let $\mathcal{O}_\mathcal{D}$
be a sheaf of rings and set
$\mathcal{O}_\mathcal{C} = g^{-1}\mathcal{O}_\mathcal{D}$.
The functor $g_! : \textit{Mod}(\mathcal{O}_\mathcal{C}) \to
\textit{Mod}(\mathcal{O}_\mathcal{D})$
(see
Modules on Sites, Lemma \ref{sites-modules-lemma-lower-shriek-modules})
has a left derived functor
$$
Lg_! : D(\mathcal{O}_\mathcal{C}) \longrightarrow D(\mathcal{O}_\mathcal{D})
$$
which is left adjoint to $g^*$. Moreover, for $U \in \Ob(\mathcal{C})$ we
have
$$
Lg_!(j_{U!}\mathcal{O}_U) =
g_!j_{U!}\mathcal{O}_U =
j_{u(U)!} \mathcal{O}_{u(U)}.
$$
where $j_{U!}$ and $j_{u(U)!}$ are extension by zero associated to the
localization morphism
$j_U : \mathcal{C}/U \to \mathcal{C}$ and
$j_{u(U)} : \mathcal{D}/u(U) \to \mathcal{D}$.
\end{lemma}

\begin{proof}
We are going to use
Derived Categories, Proposition \ref{derived-proposition-left-derived-exists}
to construct $Lg_!$. To do this we have to verify assumptions
(1), (2), (3), (4), and (5) of that proposition.
First, since $g_!$ is a left adjoint
we see that it is right exact and commutes with all colimits, so
(5) holds. Conditions (3) and (4) hold because the category of modules
on a ringed site is a Grothendieck abelian category.
Let $\mathcal{P} \subset \Ob(\textit{Mod}(\mathcal{O}_\mathcal{C}))$
be the collection of $\mathcal{O}_\mathcal{C}$-modules which are direct
sums of modules of the form $j_{U!}\mathcal{O}_U$. Note that
$g_!j_{U!}\mathcal{O}_U = j_{u(U)!} \mathcal{O}_{u(U)}$, see proof of
Modules on Sites, Lemma \ref{sites-modules-lemma-lower-shriek-modules}.
Every $\mathcal{O}_\mathcal{C}$-module is a quotient of an object of
$\mathcal{P}$, see
Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat}.
Thus (1) holds. Finally, we have to prove (2).
Let $\mathcal{K}^\bullet$ be a bounded above acyclic complex of
$\mathcal{O}_\mathcal{C}$-modules with $\mathcal{K}^n \in \mathcal{P}$
for all $n$. We have to show that $g_!\mathcal{K}^\bullet$ is
exact. To do this it suffices to show, for every injective
$\mathcal{O}_\mathcal{D}$-module $\mathcal{I}$ that
$$
\Hom_{D(\mathcal{O}_\mathcal{D})}(
g_!\mathcal{K}^\bullet, \mathcal{I}[n]) = 0
$$
for all $n \in \mathbf{Z}$. Since $\mathcal{I}$ is injective we have
\begin{align*}
\Hom_{D(\mathcal{O}_\mathcal{D})}(
g_!\mathcal{K}^\bullet, \mathcal{I}[n])
& =
\Hom_{K(\mathcal{O}_\mathcal{D})}(
g_!\mathcal{K}^\bullet, \mathcal{I}[n]) \\
& =
H^n(\Hom_{\mathcal{O}_\mathcal{D}}(
g_!\mathcal{K}^\bullet, \mathcal{I})) \\
& =
H^n(\Hom_{\mathcal{O}_\mathcal{C}}(
\mathcal{K}^\bullet, g^{-1}\mathcal{I}))
\end{align*}
the last equality by the adjointness of $g_!$ and $g^{-1}$.

\medskip\noindent
The vanishing of this group would be clear if $g^{-1}\mathcal{I}$
were an injective $\mathcal{O}_\mathcal{C}$-module. But
$g^{-1}\mathcal{I}$ isn't necessarily an injective
$\mathcal{O}_\mathcal{C}$-module as $g_!$ isn't exact in
general. We do know that
$$
\Ext^p_{\mathcal{O}_\mathcal{C}}(
j_{U!}\mathcal{O}_U, g^{-1}\mathcal{I}) =
H^p(U, g^{-1}\mathcal{I}) = 0 \text{ for }p \geq 1
$$
Here the first equality follows from
$\Hom_{\mathcal{O}_\mathcal{C}}(j_{U!}\mathcal{O}_U, \mathcal{H}) =
\mathcal{H}(U)$ and taking derived functors and the vanishing of
$H^p(U, g^{-1}\mathcal{I})$ for $p > 0$ and $U \in \Ob(\mathcal{C})$
follows from Lemma \ref{lemma-pullback-injective-pre-limp}.
Since each $\mathcal{K}^{-q}$ is a direct sum of modules of the form
$j_{U!}\mathcal{O}_U$ we see that
$$
\Ext^p_{\mathcal{O}_\mathcal{C}}(\mathcal{K}^{-q}, g^{-1}\mathcal{I}) = 0
\text{ for }p \geq 1\text{ and all }q
$$
Let us use the spectral sequence (see
Example
\ref{example-hom-complex-into-sheaf})
$$
E_1^{p, q} = \Ext^p_{\mathcal{O}_\mathcal{C}}(
\mathcal{K}^{-q}, g^{-1}\mathcal{I})
\Rightarrow
\Ext^{p + q}_{\mathcal{O}_\mathcal{C}}(
\mathcal{K}^\bullet, g^{-1}\mathcal{I}) = 0.
$$
Note that the spectral sequence abuts to zero as $\mathcal{K}^\bullet$
is acyclic (hence vanishes in the derived category, hence produces
vanishing ext groups). By the vanishing of higher exts proved above
the only nonzero terms on the $E_1$ page are the terms
$E_1^{0, q} = \Hom_{\mathcal{O}_\mathcal{C}}(
\mathcal{K}^{-q}, g^{-1}\mathcal{I})$.
We conclude that the complex
$\Hom_{\mathcal{O}_\mathcal{C}}(
\mathcal{K}^\bullet, g^{-1}\mathcal{I})$
is acyclic as desired.

\medskip\noindent
Thus the left derived functor $Lg_!$ exists.
It is left adjoint to $g^{-1} = g^* = Rg^* = Lg^*$, i.e., we have
\begin{equation}
\label{equation-to-prove}
\Hom_{D(\mathcal{O}_\mathcal{C})}(K, g^*L) =
\Hom_{D(\mathcal{O}_\mathcal{D})}(Lg_!K, L)
\end{equation}
by Derived Categories, Lemma \ref{derived-lemma-derived-adjoint-functors}.
This finishes the proof.
\end{proof}

\begin{remark}
\label{remark-when-derived-shriek-equal}
Warning! Let $u : \mathcal{C} \to \mathcal{D}$, $g$, $\mathcal{O}_\mathcal{D}$,
and $\mathcal{O}_\mathcal{C}$ be as in
Lemma \ref{lemma-existence-derived-lower-shriek}.
In general it is {\bf not} the case that the diagram
$$
\xymatrix{
D(\mathcal{O}_\mathcal{C}) \ar[r]_{Lg_!} \ar[d]_{forget} &
D(\mathcal{O}_\mathcal{D}) \ar[d]^{forget} \\
D(\mathcal{C}) \ar[r]^{Lg^{Ab}_!} &
D(\mathcal{D})
}
$$
commutes where the functor $Lg_!^{Ab}$ is the one constructed in
Lemma \ref{lemma-existence-derived-lower-shriek}
but using the constant sheaf $\mathbf{Z}$ as the structure sheaf
on both $\mathcal{C}$ and $\mathcal{D}$. In general it isn't even
the case that $g_! = g_!^{Ab}$ (see
Modules on Sites, Remark \ref{sites-modules-remark-when-shriek-equal}),
but this phenomenon {\bf can occur even if $g_! = g_!^{Ab}$}! Namely,
the construction of $Lg_!$ in the proof of
Lemma \ref{lemma-existence-derived-lower-shriek}
shows that $Lg_!$ agrees with $Lg_!^{\textit{Ab}}$ if and only if
the canonical maps
$$
Lg^{Ab}_!j_{U!}\mathcal{O}_U \longrightarrow j_{u(U)!}\mathcal{O}_{u(U)}
$$
are isomorphisms in $D(\mathcal{D})$ for all objects $U$ in $\mathcal{C}$.
In general all we can say is that there exists a natural transformation
$$
Lg_!^{Ab} \circ forget \longrightarrow forget \circ Lg_!
$$
\end{remark}

\begin{lemma}
\label{lemma-pullback-injective-limp}
Let $u : \mathcal{C} \to \mathcal{D}$ be a continuous and cocontinuous
functor of sites. Let $g : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$
be the corresponding morphism of topoi. Let $\mathcal{O}_\mathcal{D}$
be a sheaf of rings and let $\mathcal{I}$ be an injective
$\mathcal{O}_\mathcal{D}$-module. If
$g_!^{Sh} : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$
commutes with fibre products\footnote{Holds if $\mathcal{C}$
has finite connected limits and $u$ commutes with them, see
Sites, Lemma \ref{sites-lemma-preserve-equalizers}.}, then
$g^{-1}\mathcal{I}$ is totally acyclic.
\end{lemma}

\begin{proof}
We will use the criterion of Lemma \ref{lemma-characterize-limp}.
Condition (1) holds by Lemma \ref{lemma-pullback-injective-pre-limp}.
Let $K' \to K$ be a surjective map of sheaves of sets on $\mathcal{C}$.
Since $g_!^{Sh}$ is a left adjoint,
we see that $g_!^{Sh}K' \to g_!^{Sh}K$ is surjective.
Observe that
\begin{align*}
H^0(K' \times_K \ldots \times_K K', g^{-1}\mathcal{I}) 
& =
H^0(g_!^{Sh}(K' \times_K \ldots \times_K K'), \mathcal{I}) \\
& =
H^0(g_!^{Sh}K' \times_{g_!^{Sh}K} \ldots \times_{g_!^{Sh}K} g_!^{Sh}K',
\mathcal{I})
\end{align*}
by our assumption on $g_!^{Sh}$. Since $\mathcal{I}$ is an injective module
it is totally acyclic by Lemma \ref{lemma-direct-image-injective-sheaf}
(applied to the identity). Hence we can use the converse of
Lemma \ref{lemma-characterize-limp} to see that the complex
$$
0 \to H^0(K, g^{-1}\mathcal{I}) \to H^0(K', g^{-1}\mathcal{I}) \to
H^0(K' \times_K K', g^{-1}\mathcal{I}) \to \ldots
$$
is exact as desired.
\end{proof}

\begin{lemma}
\label{lemma-pullback-same-cohomology}
Let $u : \mathcal{C} \to \mathcal{D}$ be a continuous and cocontinuous
functor of sites. Let $g : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$
be the corresponding morphism of topoi. Let $U \in \Ob(\mathcal{C})$.
\begin{enumerate}
\item For $M$ in $D(\mathcal{D})$ we have
$R\Gamma(U, g^{-1}M) = R\Gamma(u(U), M)$.
\item If $\mathcal{O}_\mathcal{D}$ is a sheaf of rings and
$\mathcal{O}_\mathcal{C} = g^{-1}\mathcal{O}_\mathcal{D}$, then
for $M$ in $D(\mathcal{O}_\mathcal{D})$ we have
$R\Gamma(U, g^*M) = R\Gamma(u(U), M)$.
\end{enumerate}
\end{lemma}

\begin{proof}
In the bounded below case (1) and (2) can be seen by representing
$K$ by a bounded below complex of injectives and using
Lemma \ref{lemma-pullback-injective-pre-limp} as well as
Leray's acyclicity lemma.
In the unbounded case, first note that
(1) is a special case of (2). For (2) we can use
$$
R\Gamma(U, g^*M) =
R\Hom_{\mathcal{O}_\mathcal{C}}(j_{U!}\mathcal{O}_U, g^*M) =
R\Hom_{\mathcal{O}_\mathcal{D}}(j_{u(U)!}\mathcal{O}_{u(U)}, M) =
R\Gamma(u(U), M)
$$
where the middle equality is a consequence of
Lemma \ref{lemma-existence-derived-lower-shriek}.
\end{proof}

\begin{lemma}
\label{lemma-special-square-cocontinuous}
Assume given a commutative diagram
$$
\xymatrix{
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'})
\ar[r]_{(g', (g')^\sharp)} \ar[d]_{(f', (f')^\sharp)} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^{(f, f^\sharp)} \\
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'}) \ar[r]^{(g, g^\sharp)} &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
of ringed topoi. Assume
\begin{enumerate}
\item $f$, $f'$, $g$, and $g'$ correspond to cocontinuous functors
$u$, $u'$, $v$, and $v'$ as in
Sites, Lemma \ref{sites-lemma-cocontinuous-morphism-topoi},
\item $v \circ u' = u \circ v'$,
\item $v$ and $v'$ are continuous as well as cocontinuous,
\item for any object $V'$ of $\mathcal{D}'$ the functor
${}^{u'}_{V'}\mathcal{I} \to {}^{\ \ \ u}_{v(V')}\mathcal{I}$
given by $v$ is cofinal,
\item $g^{-1}\mathcal{O}_{\mathcal{D}} = \mathcal{O}_{\mathcal{D}'}$
and $(g')^{-1}\mathcal{O}_{\mathcal{C}} = \mathcal{O}_{\mathcal{C}'}$, and
\item $g'_! : \textit{Ab}(\mathcal{C}') \to \textit{Ab}(\mathcal{C})$
is exact\footnote{Holds if fibre products and equalizers exist in
$\mathcal{C}'$ and $v'$ commutes with them, see
Modules on Sites, Lemma \ref{sites-modules-lemma-exactness-lower-shriek}.}.
\end{enumerate}
Then we have $Rf'_* \circ (g')^* = g^* \circ Rf_*$ as functors
$D(\mathcal{O}_\mathcal{C}) \to D(\mathcal{O}_{\mathcal{D}'})$.
\end{lemma}

\begin{proof}
We have $g^* = Lg^* = g^{-1}$ and $(g')^* = L(g')^* = (g')^{-1}$
by condition (5).
By Lemma \ref{lemma-modules-abelian-unbounded} it suffices
to prove the result on the derived category $D(\mathcal{C})$
of abelian sheaves. Choose an object $K \in D(\mathcal{C})$.
Let $\mathcal{I}^\bullet$ be a K-injective complex of abelian
sheaves on $\mathcal{C}$ representing $K$. By
Derived Categories, Lemma \ref{derived-lemma-adjoint-preserve-K-injectives}
and assumption (6) we find that $(g')^{-1}\mathcal{I}^\bullet$
is a K-injective complex of abelian sheaves on $\mathcal{C}'$.
By Modules on Sites, Lemma
\ref{sites-modules-lemma-special-square-cocontinuous}
we find that $f'_*(g')^{-1}\mathcal{I}^\bullet = g^{-1}f_*\mathcal{I}^\bullet$.
Since $f_*\mathcal{I}^\bullet$ represents $Rf_*K$ and since
$f'_*(g')^{-1}\mathcal{I}^\bullet$ represents $Rf'_*(g')^{-1}K$
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-special-square-continuous}
Consider a commutative diagram
$$
\xymatrix{
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'}
\ar[r]_{(g', (g')^\sharp)} \ar[d]_{(f', (f')^\sharp)} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^{(f, f^\sharp)} \\
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'}) \ar[r]^{(g, g^\sharp)} &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
of ringed topoi and suppose we have functors
$$
\xymatrix{
\mathcal{C}' \ar[r]_{v'} &
\mathcal{C} \\
\mathcal{D}' \ar[r]^v \ar[u]^{u'} &
\mathcal{D} \ar[u]_u
}
$$
such that (with notation as in
Sites, Sections \ref{sites-section-morphism-sites} and
\ref{sites-section-cocontinuous-morphism-topoi}) we have
\begin{enumerate}
\item $u$ and $u'$ are continuous and give rise to the morphisms
$f$ and $f'$,
\item $v$ and $v'$ are cocontinuous giving rise to the morphisms $g$ and $g'$,
\item $u \circ v = v' \circ u'$,
\item $v$ and $v'$ are continuous as well as cocontinuous, and
\item $g^{-1}\mathcal{O}_{\mathcal{D}} = \mathcal{O}_{\mathcal{D}'}$
and $(g')^{-1}\mathcal{O}_{\mathcal{C}} = \mathcal{O}_{\mathcal{C}'}$.
\end{enumerate}
Then $Rf'_* \circ (g')^* = g^* \circ Rf_*$ as functors
$D^+(\mathcal{O}_\mathcal{C}) \to D^+(\mathcal{O}_{\mathcal{D}'})$.
If in addition
\begin{enumerate}
\item[(6)] $g'_! : \textit{Ab}(\mathcal{C}') \to \textit{Ab}(\mathcal{C})$
is exact\footnote{Holds if fibre products and equalizers exist in
$\mathcal{C}'$ and $v'$ commutes with them, see
Modules on Sites, Lemma \ref{sites-modules-lemma-exactness-lower-shriek}.},
\end{enumerate}
then $Rf'_* \circ (g')^* = g^* \circ Rf_*$ as functors
$D(\mathcal{O}_\mathcal{C}) \to D(\mathcal{O}_{\mathcal{D}'})$.
\end{lemma}

\begin{proof}
We have $g^* = Lg^* = g^{-1}$ and $(g')^* = L(g')^* = (g')^{-1}$
by condition (5).
By Lemma \ref{lemma-modules-abelian-unbounded} it suffices
to prove the result on the derived category $D^+(\mathcal{C})$ or
$D(\mathcal{C})$ of abelian sheaves.

\medskip\noindent
Choose an object $K \in D^+(\mathcal{C})$.
Let $\mathcal{I}^\bullet$ be a bounded below complex of injective abelian
sheaves on $\mathcal{C}$ representing $K$. By
Lemma \ref{lemma-pullback-injective-pre-limp}
we see that $H^p(U', (g')^{-1}\mathcal{I}^q) = 0$ for
all $p > 0$ and any $q$ and any $U' \in \Ob(\mathcal{C}')$.
Recall that $R^pf'_*(g')^{-1}\mathcal{I}^q$ is the sheaf
associated to the presheaf $V' \mapsto H^p(u'(V'), (g')^{-1}\mathcal{I}^q)$,
see Lemma \ref{lemma-higher-direct-images}.
Thus we see that $(g')^{-1}\mathcal{I}^q$ is right acyclic
for the functor $f'_*$. By Leray's acyclicity lemma
(Derived Categories, Lemma \ref{derived-lemma-leray-acyclicity})
we find that $f'_*(g')^*\mathcal{I}^\bullet$
represents $Rf'_*(g')^{-1}K$.
By Modules on Sites, Lemma
\ref{sites-modules-lemma-special-square-continuous}
we find that $f'_*(g')^{-1}\mathcal{I}^\bullet = g^{-1}f_*\mathcal{I}^\bullet$.
Since $g^{-1}f_*\mathcal{I}^\bullet$ represents $g^{-1}Rf_*K$
we conclude.

\medskip\noindent
Choose an object $K \in D(\mathcal{C})$.
Let $\mathcal{I}^\bullet$ be a K-injective complex of abelian
sheaves on $\mathcal{C}$ representing $K$. By
Derived Categories, Lemma \ref{derived-lemma-adjoint-preserve-K-injectives}
and assumption (6) we find that $(g')^{-1}\mathcal{I}^\bullet$
is a K-injective complex of abelian sheaves on $\mathcal{C}'$.
By Modules on Sites, Lemma
\ref{sites-modules-lemma-special-square-continuous}
we find that $f'_*(g')^{-1}\mathcal{I}^\bullet = g^{-1}f_*\mathcal{I}^\bullet$.
Since $f_*\mathcal{I}^\bullet$ represents $Rf_*K$ and since
$f'_*(g')^{-1}\mathcal{I}^\bullet$ represents $Rf'_*(g')^{-1}K$
we conclude.
\end{proof}








\section{Derived lower shriek for fibred categories}
\label{section-derived-lower-shriek-fibred}

\noindent
In this section we work out some special cases of the situation
discussed in Section \ref{section-derived-lower-shriek}.
We make sure that we have equality between lower shriek on modules
and sheaves of abelian groups. We encourage the reader to skip
this section on a first reading.

\begin{situation}
\label{situation-fibred-category}
Here $(\mathcal{D}, \mathcal{O}_\mathcal{D})$ be a ringed site
and $p : \mathcal{C} \to \mathcal{D}$ is a fibred category. We endow
$\mathcal{C}$ with the topology inherited from $\mathcal{D}$
(Stacks, Section \ref{stacks-section-topology}). We denote
$\pi : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$ the morphism of
topoi associated to $p$
(Stacks, Lemma \ref{stacks-lemma-topology-inherited-functorial}).
We set $\mathcal{O}_\mathcal{C} = \pi^{-1}\mathcal{O}_\mathcal{D}$
so that we obtain a morphism of ringed topoi
$$
\pi :
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\longrightarrow
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
$$
\end{situation}

\begin{lemma}
\label{lemma-fibred-category-with-object}
Assumptions and notation as in Situation \ref{situation-fibred-category}.
For $U \in \Ob(\mathcal{C})$ consider the induced morphism
of topoi
$$
\pi_U : \Sh(\mathcal{C}/U) \longrightarrow \Sh(\mathcal{D}/p(U))
$$
Then there exists a morphism of topoi
$$
\sigma : \Sh(\mathcal{D}/p(U)) \to \Sh(\mathcal{C}/U)
$$
such that $\pi_U \circ \sigma = \text{id}$ and $\sigma^{-1} = \pi_{U, *}$.
\end{lemma}

\begin{proof}
Observe that $\pi_U$ is the restriction of $\pi$ to the localizations, see
Sites, Lemma \ref{sites-lemma-localize-cocontinuous}.
For an object $V \to p(U)$ of $\mathcal{D}/p(U)$ denote
$V \times_{p(U)} U \to U$ the strongly cartesian morphism of $\mathcal{C}$
over $\mathcal{D}$ which exists as $p$ is a fibred category.
The functor
$$
v : \mathcal{D}/p(U) \to \mathcal{C}/U,\quad
V/p(U) \mapsto V \times_{p(U)} U/U
$$
is continuous by the definition of the topology on $\mathcal{C}$.
Moreover, it is a right adjoint to $p$ by the definition of strongly
cartesian morphisms. Hence we are in the situation discussed in
Sites, Section \ref{sites-section-cocontinuous-adjoint}
and we see that the sheaf $\pi_{U, *}\mathcal{F}$
is equal to $V \mapsto \mathcal{F}(V \times_{p(U)} U)$
(see especially Sites, Lemma
\ref{sites-lemma-have-functor-other-way-morphism}).

\medskip\noindent
But here we have more. Namely, the functor $v$
is also cocontinuous (as all morphisms in coverings of $\mathcal{C}$ 
are strongly cartesian). Hence $v$ defines a morphism $\sigma$ as
indicated in the lemma. The equality $\sigma^{-1} = \pi_{U, *}$
is immediate from the definition. Since $\pi_U^{-1}\mathcal{G}$
is given by the rule $U'/U \mapsto \mathcal{G}(p(U')/p(U))$
it follows that $\sigma^{-1} \circ \pi_U^{-1} = \text{id}$
which proves the equality
$\pi_U \circ \sigma = \text{id}$.
\end{proof}

\begin{situation}
\label{situation-morphism-fibred-categories}
Let $(\mathcal{D}, \mathcal{O}_\mathcal{D})$ be a ringed site.
Let $u : \mathcal{C}' \to \mathcal{C}$ be a $1$-morphism of fibred
categories over $\mathcal{D}$
(Categories, Definition \ref{categories-definition-fibred-categories-over-C}).
Endow $\mathcal{C}$ and $\mathcal{C}'$ with their inherited topologies
(Stacks, Definition \ref{stacks-definition-topology-inherited})
and let
$\pi : \Sh(\mathcal{C}) \to \Sh(\mathcal{D})$,
$\pi' : \Sh(\mathcal{C}') \to \Sh(\mathcal{D})$, and
$g : \Sh(\mathcal{C}') \to \Sh(\mathcal{C})$
be the corresponding morphisms of topoi
(Stacks, Lemma \ref{stacks-lemma-topology-inherited-functorial}).
Set $\mathcal{O}_\mathcal{C} = \pi^{-1}\mathcal{O}_\mathcal{D}$
and $\mathcal{O}_{\mathcal{C}'} = (\pi')^{-1}\mathcal{O}_\mathcal{D}$.
Observe that $g^{-1}\mathcal{O}_\mathcal{C} = \mathcal{O}_{\mathcal{C}'}$
so that
$$
\xymatrix{
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'}) \ar[rd]_{\pi'} \ar[rr]_g & &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[ld]^\pi \\
& (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
is a commutative diagram of morphisms of ringed topoi.
\end{situation}

\begin{lemma}
\label{lemma-morphism-fibred-categories-with-object}
Assumptions and notation as in
Situation \ref{situation-morphism-fibred-categories}.
For $U' \in \Ob(\mathcal{C}')$ set $U = u(U')$ and $V = p'(U')$ and
consider the induced morphisms of ringed topoi
$$
\xymatrix{
(\Sh(\mathcal{C}'/U'), \mathcal{O}_{U'}) \ar[rd]_{\pi'_{U'}} \ar[rr]_{g'} & &
(\Sh(\mathcal{C}), \mathcal{O}_U) \ar[ld]^{\pi_U} \\
& (\Sh(\mathcal{D}/V), \mathcal{O}_V)
}
$$
Then there exists a morphism of topoi
$$
\sigma' : \Sh(\mathcal{D}/V) \to \Sh(\mathcal{C}'/U'),
$$
such that setting $\sigma = g' \circ \sigma'$ we have
$\pi'_{U'} \circ \sigma' = \text{id}$, $\pi_U \circ \sigma = \text{id}$,
$(\sigma')^{-1} = \pi'_{U', *}$, and $\sigma^{-1} = \pi_{U, *}$.
\end{lemma}

\begin{proof}
Let $v' : \mathcal{D}/V \to \mathcal{C}'/U'$ be the functor constructed
in the proof of Lemma \ref{lemma-fibred-category-with-object} starting
with $p' : \mathcal{C}' \to \mathcal{D}'$ and the object $U'$.
Since $u$ is a $1$-morphism of fibred categories over $\mathcal{D}$
it transforms strongly cartesian morphisms into strongly cartesian morphisms,
hence the functor $v = u \circ v'$ is the functor of
the proof of Lemma \ref{lemma-fibred-category-with-object}
relative to $p : \mathcal{C} \to \mathcal{D}$ and $U$. Thus our lemma
follows from that lemma.
\end{proof}

\begin{lemma}
\label{lemma-properties-lower-shriek-fibred-category}
Assumption and notation as in
Situation \ref{situation-morphism-fibred-categories}.
\begin{enumerate}
\item There are left adjoints
$g_! : \textit{Mod}(\mathcal{O}_{\mathcal{C}'}) \to
\textit{Mod}(\mathcal{O}_\mathcal{C})$ and
$g_!^{\textit{Ab}} : \textit{Ab}(\mathcal{C}') \to \textit{Ab}(\mathcal{C})$
to $g^* = g^{-1}$ on modules and on abelian sheaves.
\item The diagram
$$
\xymatrix{
\textit{Mod}(\mathcal{O}_{\mathcal{C}'}) \ar[d] \ar[r]_{g_!} &
\textit{Mod}(\mathcal{O}_\mathcal{C}) \ar[d] \\
\textit{Ab}(\mathcal{C}') \ar[r]^{g_!^{\textit{Ab}}} &
\textit{Ab}(\mathcal{C})
}
$$
commutes.
\item There are left adjoints
$Lg_! : D(\mathcal{O}_{\mathcal{C}'}) \to D(\mathcal{O}_\mathcal{C})$
and
$Lg_!^{\textit{Ab}} : D(\mathcal{C}') \to D(\mathcal{C})$
to $g^* = g^{-1}$ on derived categories of modules and abelian sheaves.
\item The diagram
$$
\xymatrix{
D(\mathcal{O}_{\mathcal{C}'}) \ar[d] \ar[r]_{Lg_!} &
D(\mathcal{O}_\mathcal{C}) \ar[d] \\
D(\mathcal{C}') \ar[r]^{Lg_!^{\textit{Ab}}} &
D(\mathcal{C})
}
$$
commutes.
\end{enumerate}
\end{lemma}

\begin{proof}
The functor $u$ is continuous and cocontinuous
Stacks, Lemma \ref{stacks-lemma-topology-inherited-functorial}.
Hence the existence of the functors $g_!$, $g_!^{\textit{Ab}}$,
$Lg_!$, and $Lg_!^{\textit{Ab}}$ can be found in
Modules on Sites, Sections
\ref{sites-modules-section-exactness-lower-shriek} and
\ref{sites-modules-section-lower-shriek-modules}
and
Section \ref{section-derived-lower-shriek}.

\medskip\noindent
To prove (2) it suffices to show that the canonical map
$$
g_!^{\textit{Ab}}j_{U'!}\mathcal{O}_{U'} \to j_{u(U')!}\mathcal{O}_{u(U')}
$$
is an isomorphism for all objects $U'$ of $\mathcal{C}'$, see
Modules on Sites, Remark \ref{sites-modules-remark-when-shriek-equal}.
Similarly, to prove (4) it suffices to show that the canonical map
$$
Lg_!^{\textit{Ab}}j_{U'!}\mathcal{O}_{U'} \to j_{u(U')!}\mathcal{O}_{u(U')}
$$
is an isomorphism in $D(\mathcal{C})$ for all objects $U'$ of
$\mathcal{C}'$, see Remark \ref{remark-when-derived-shriek-equal}.
This will also imply the previous formula hence this is what we will show.

\medskip\noindent
We will use that for a localization morphism $j$ the
functors $j_!$ and $j_!^{\textit{Ab}}$ agree (see
Modules on Sites, Remark \ref{sites-modules-remark-localize-shriek-equal})
and that $j_!$ is exact
(Modules on Sites, Lemma \ref{sites-modules-lemma-extension-by-zero-exact}).
Let us adopt the notation of
Lemma \ref{lemma-morphism-fibred-categories-with-object}.
Since $Lg_!^{\textit{Ab}} \circ j_{U'!} = j_{U!} \circ L(g')^{\textit{Ab}}_!$
(by commutativity of Sites, Lemma \ref{sites-lemma-localize-cocontinuous}
and uniqueness of adjoint functors) it suffices to prove that
$L(g')^{\textit{Ab}}_!\mathcal{O}_{U'} = \mathcal{O}_U$. Using the
results of
Lemma \ref{lemma-morphism-fibred-categories-with-object}
we have for any object $E$ of $D(\mathcal{C}/u(U'))$ the following
sequence of equalities
\begin{align*}
\Hom_{D(\mathcal{C}/U)}(L(g')_!^{\textit{Ab}}\mathcal{O}_{U'}, E)
& =
\Hom_{D(\mathcal{C}'/U')}(\mathcal{O}_{U'}, (g')^{-1}E) \\
& =
\Hom_{D(\mathcal{C}'/U')}((\pi'_{U'})^{-1}\mathcal{O}_V, (g')^{-1}E) \\
& =
\Hom_{D(\mathcal{D}/V)}(\mathcal{O}_V, R\pi'_{U', *}(g')^{-1}E) \\
& =
\Hom_{D(\mathcal{D}/V)}(\mathcal{O}_V, (\sigma')^{-1}(g')^{-1}E) \\
& =
\Hom_{D(\mathcal{D}/V)}(\mathcal{O}_V, \sigma^{-1}E) \\
& =
\Hom_{D(\mathcal{D}/V)}(\mathcal{O}_V, \pi_{U, *}E) \\
& =
\Hom_{D(\mathcal{C}/U)}(\pi_U^{-1}\mathcal{O}_V, E) \\
& =
\Hom_{D(\mathcal{C}/U)}(\mathcal{O}_U, E)
\end{align*}
By Yoneda's lemma we conclude.
\end{proof}

\begin{remark}
\label{remark-fibred-category}
Assumptions and notation as in Situation \ref{situation-fibred-category}.
Note that setting $\mathcal{C}' = \mathcal{D}$ and $u$ equal to the
structure functor of $\mathcal{C}$ gives a situation as in
Situation \ref{situation-morphism-fibred-categories}. Hence
Lemma \ref{lemma-properties-lower-shriek-fibred-category}
tells us we have functors  $\pi_!$, $\pi_!^{\textit{Ab}}$, $L\pi_!$, and
$L\pi_!^{\textit{Ab}}$ such that
$forget \circ \pi_! = \pi_!^{\textit{Ab}} \circ forget$ and
$forget \circ L\pi_! = L\pi_!^{\textit{Ab}} \circ forget$.
\end{remark}

\begin{remark}
\label{remark-morphism-fibred-categories}
Assumptions and notation as in
Situation \ref{situation-morphism-fibred-categories}.
Let $\mathcal{F}$ be an abelian sheaf on $\mathcal{C}$,
let $\mathcal{F}'$ be an abelian sheaf on $\mathcal{C}'$,
and let $t : \mathcal{F}' \to g^{-1}\mathcal{F}$ be a map.
Then we obtain a canonical map
$$
L\pi'_!(\mathcal{F}') \longrightarrow L\pi_!(\mathcal{F})
$$
by using the adjoint $g_!\mathcal{F}' \to \mathcal{F}$ of $t$,
the map $Lg_!(\mathcal{F}') \to g_!\mathcal{F}'$, and the
equality $L\pi'_! = L\pi_! \circ Lg_!$.
\end{remark}

\begin{lemma}
\label{lemma-compute-pi-shriek}
Assumptions and notation as in
Situation \ref{situation-fibred-category}.
For $\mathcal{F}$ in $\textit{Ab}(\mathcal{C})$
the sheaf $\pi_!\mathcal{F}$ is the
sheaf associated to the presheaf
$$
V \longmapsto \colim_{\mathcal{C}_V^{opp}} \mathcal{F}|_{\mathcal{C}_V}
$$
with restriction maps as indicated in the proof.
\end{lemma}

\begin{proof}
Denote $\mathcal{H}$ be the rule of the lemma.
For a morphism $h : V' \to V$ of $\mathcal{D}$ there is a
pullback functor $h^* : \mathcal{C}_V \to \mathcal{C}_{V'}$ of fibre
categories (Categories, Definition
\ref{categories-definition-pullback-functor-fibred-category}).
Moreover for $U \in \Ob(\mathcal{C}_V)$ there is a
strongly cartesian morphism $h^*U \to U$ covering $h$.
Restriction along these strongly cartesian morphisms defines a
transformation of functors
$$
\mathcal{F}|_{\mathcal{C}_V}
\longrightarrow
\mathcal{F}|_{\mathcal{C}_{V'}} \circ h^*.
$$
Hence a map $\mathcal{H}(V) \to \mathcal{H}(V')$ between colimits, see
Categories, Lemma \ref{categories-lemma-functorial-colimit}.

\medskip\noindent
To prove the lemma we show that
$$
\Mor_{\textit{PSh}(\mathcal{D})}(\mathcal{H}, \mathcal{G}) =
\Mor_{\Sh(\mathcal{C})}(\mathcal{F}, \pi^{-1}\mathcal{G})
$$
for every sheaf $\mathcal{G}$ on $\mathcal{C}$. An element of the
left hand side is a compatible system of maps
$\mathcal{F}(U) \to \mathcal{G}(p(U))$ for all $U$ in $\mathcal{C}$.
Since $\pi^{-1}\mathcal{G}(U) = \mathcal{G}(p(U))$ by our choice
of topology on $\mathcal{C}$ we see the same thing is true for the
right hand side and we win.
\end{proof}





\section{Homology on a category}
\label{section-homology}

\noindent
In the case of a category over a point we will baptize the left derived
lower shriek functors the homology functors.

\begin{example}[Category over point]
\label{example-category-to-point}
Let $\mathcal{C}$ be a category. Endow $\mathcal{C}$ with the chaotic
topology (Sites, Example \ref{sites-example-indiscrete}). Thus
presheaves and sheaves agree on $\mathcal{C}$.
The functor $p : \mathcal{C} \to *$ where $*$ is the category with a single
object and a single morphism is cocontinuous and continuous. Let
$\pi : \Sh(\mathcal{C}) \to \Sh(*)$ be the corresponding morphism
of topoi. Let $B$ be a ring. We endow $*$ with the sheaf of rings $B$
and $\mathcal{C}$ with $\mathcal{O}_\mathcal{C} = \pi^{-1}B$ which
we will denote $\underline{B}$. In this way
$$
\pi : (\Sh(\mathcal{C}), \underline{B}) \to (\Sh(*), B)
$$
is an example of Situation \ref{situation-fibred-category}.
By Remark \ref{remark-fibred-category} we do not need to distinguish
between $\pi_!$ on modules or abelian sheaves. By
Lemma \ref{lemma-compute-pi-shriek} we see that
$\pi_!\mathcal{F} = \colim_{\mathcal{C}^{opp}} \mathcal{F}$.
Thus $L_n\pi_!$ is the $n$th left derived functor of taking colimits.
In the following, we write
$$
H_n(\mathcal{C}, \mathcal{F}) = L_n\pi_!(\mathcal{F})
$$
and we will name this the {\it $n$th homology group of $\mathcal{F}$}
on $\mathcal{C}$.
\end{example}

\begin{example}[Computing homology]
\label{example-left-derived-colimits}
In Example \ref{example-category-to-point} we can compute
the functors $H_n(\mathcal{C}, -)$ as follows. Let
$\mathcal{F} \in \Ob(\textit{Ab}(\mathcal{C}))$.
Consider the chain complex
$$
K_\bullet(\mathcal{F}) :
\ \ldots \to
\bigoplus\nolimits_{U_2 \to U_1 \to U_0} \mathcal{F}(U_0)
\to
\bigoplus\nolimits_{U_1 \to U_0} \mathcal{F}(U_0)
\to
\bigoplus\nolimits_{U_0} \mathcal{F}(U_0)
$$
where the transition maps are given by
$$
(U_2 \to U_1 \to U_0, s)
\longmapsto
(U_1 \to U_0, s) - (U_2 \to U_0, s) + (U_2 \to U_1, s|_{U_1})
$$
and similarly in other degrees. By construction
$$
H_0(\mathcal{C}, \mathcal{F}) =
\colim_{\mathcal{C}^{opp}} \mathcal{F} =
H_0(K_\bullet(\mathcal{F})),
$$
see Categories, Lemma \ref{categories-lemma-colimits-coproducts-coequalizers}.
The construction of $K_\bullet(\mathcal{F})$ is functorial in $\mathcal{F}$
and transforms short exact sequences of $\textit{Ab}(\mathcal{C})$ into
short exact sequences of complexes. Thus the sequence of functors
$\mathcal{F} \mapsto H_n(K_\bullet(\mathcal{F}))$ forms a $\delta$-functor, see
Homology, Definition \ref{homology-definition-cohomological-delta-functor} and
Lemma \ref{homology-lemma-long-exact-sequence-cochain}.
For $\mathcal{F} = j_{U!}\mathbf{Z}_U$ the complex $K_\bullet(\mathcal{F})$
is the complex associated to the free $\mathbf{Z}$-module on the simplicial
set $X_\bullet$ with terms
$$
X_n = \coprod\nolimits_{U_n \to \ldots \to U_1 \to U_0}
\Mor_\mathcal{C}(U_0, U)
$$
This simplicial set is homotopy equivalent to the constant simplicial
set on a singleton $\{*\}$. Namely, the map $X_\bullet \to \{*\}$
is obvious, the map $\{*\} \to X_n$ is given
by mapping $*$ to $(U \to \ldots \to U, \text{id}_U)$, and the
maps
$$
h_{n, i} : X_n \longrightarrow X_n
$$
(Simplicial, Lemma \ref{simplicial-lemma-relations-homotopy})
defining the homotopy between the two maps $X_\bullet \to X_\bullet$
are given by the rule
$$
h_{n, i} :
(U_n \to \ldots \to U_0, f)
\longmapsto
(U_n \to \ldots \to U_i \to U \to \ldots \to U, \text{id})
$$
for $i > 0$ and $h_{n, 0} = \text{id}$. Verifications omitted.
This implies that $K_\bullet(j_{U!}\mathbf{Z}_U)$ has trivial
cohomology in negative degrees
(by the functoriality of
Simplicial, Remark \ref{simplicial-remark-homotopy-better}
and the result of
Simplicial, Lemma \ref{simplicial-lemma-homotopy-s-N}).
Thus $K_\bullet(\mathcal{F})$ computes the left derived functors
$H_n(\mathcal{C}, -)$ of $H_0(\mathcal{C}, -)$
for example by (the duals of)
Homology, Lemma \ref{homology-lemma-efface-implies-universal}
and
Derived Categories, Lemma \ref{derived-lemma-right-derived-delta-functor}.
\end{example}

\begin{example}
\label{example-morphism-categories}
Let $u : \mathcal{C}' \to \mathcal{C}$ be a functor.
Endow $\mathcal{C}'$ and $\mathcal{C}$ with the chaotic
topology as in Example \ref{example-category-to-point}.
The functors $u$, $\mathcal{C}' \to *$, and $\mathcal{C} \to *$
where $*$ is the category with a single object and a single morphism
are cocontinuous and continuous. Let
$g : \Sh(\mathcal{C}') \to \Sh(\mathcal{C})$,
$\pi' : \Sh(\mathcal{C}') \to \Sh(*)$, and
$\pi : \Sh(\mathcal{C}) \to \Sh(*)$,
be the corresponding morphisms of topoi.
Let $B$ be a ring. We endow $*$ with the sheaf of rings $B$ and
$\mathcal{C}'$, $\mathcal{C}$ with the constant sheaf $\underline{B}$.
In this way
$$
\xymatrix{
(\Sh(\mathcal{C}'), \underline{B}) \ar[rd]_{\pi'} \ar[rr]_g & &
(\Sh(\mathcal{C}), \underline{B}) \ar[ld]^\pi \\
& (\Sh(*), B)
}
$$
is an example of Situation \ref{situation-morphism-fibred-categories}.
Thus
Lemma \ref{lemma-properties-lower-shriek-fibred-category}
applies to $g$ so we do not need to distinguish between $g_!$ on
modules or abelian sheaves. In particular
Remark \ref{remark-morphism-fibred-categories}
produces canonical maps
$$
H_n(\mathcal{C}', \mathcal{F}')
\longrightarrow
H_n(\mathcal{C}, \mathcal{F})
$$
whenever we have $\mathcal{F}$ in $\textit{Ab}(\mathcal{C})$,
$\mathcal{F}'$ in $\textit{Ab}(\mathcal{C}')$,
and a map $t : \mathcal{F}' \to g^{-1}\mathcal{F}$. In terms of the
computation of homology given in
Example \ref{example-left-derived-colimits}
we see that these maps come from a map of complexes
$$
K_\bullet(\mathcal{F}') \longrightarrow K_\bullet(\mathcal{F})
$$
given by the rule
$$
(U'_n \to \ldots \to U'_0, s') \longmapsto
(u(U'_n) \to \ldots \to u(U'_0), t(s'))
$$
with obvious notation.
\end{example}

\begin{remark}
\label{remark-map-evaluation-to-derived}
Notation and assumptions as in Example \ref{example-category-to-point}.
Let $\mathcal{F}^\bullet$ be a bounded complex of abelian sheaves on
$\mathcal{C}$. For any object $U$ of $\mathcal{C}$ there is a canonical
map
$$
\mathcal{F}^\bullet(U) \longrightarrow L\pi_!(\mathcal{F}^\bullet)
$$
in $D(\textit{Ab})$. If $\mathcal{F}^\bullet$ is a complex of
$\underline{B}$-modules then this map is in $D(B)$. To prove this, note
that we compute $L\pi_!(\mathcal{F}^\bullet)$ by taking a quasi-isomorphism
$\mathcal{P}^\bullet \to \mathcal{F}^\bullet$ where $\mathcal{P}^\bullet$
is a complex of projectives. However, since the topology is chaotic
this means that $\mathcal{P}^\bullet(U) \to \mathcal{F}^\bullet(U)$
is a quasi-isomorphism hence can be inverted in
$D(\textit{Ab})$, resp.\ $D(B)$. Composing with the canonical map
$\mathcal{P}^\bullet(U) \to \pi_!(\mathcal{P}^\bullet)$ coming from
the computation of $\pi_!$ as a colimit we obtain the desired arrow.
\end{remark}

\begin{lemma}
\label{lemma-initial-final}
Notation and assumptions as in Example \ref{example-category-to-point}.
If $\mathcal{C}$ has either an initial or a final object, then
$L\pi_! \circ \pi^{-1} = \text{id}$ on $D(\textit{Ab})$, resp.\ $D(B)$.
\end{lemma}

\begin{proof}
If $\mathcal{C}$ has an initial object, then $\pi_!$ is computed by
evaluating on this object and the statement is clear. If $\mathcal{C}$
has a final object, then $R\pi_*$ is computed by evaluating on this
object, hence $R\pi_* \circ \pi^{-1} \cong \text{id}$ on
$D(\textit{Ab})$, resp.\ $D(B)$. This implies that
$\pi^{-1} : D(\textit{Ab}) \to D(\mathcal{C})$,
resp.\ $\pi^{-1} : D(B) \to D(\underline{B})$ is fully faithful, see
Categories, Lemma \ref{categories-lemma-adjoint-fully-faithful}.
Then the same lemma implies that $L\pi_! \circ \pi^{-1} = \text{id}$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-change-of-rings}
Notation and assumptions as in Example \ref{example-category-to-point}.
Let $B \to B'$ be a ring map. Consider the commutative diagram
of ringed topoi
$$
\xymatrix{
(\Sh(\mathcal{C}), \underline{B}) \ar[d]_\pi &
(\Sh(\mathcal{C}), \underline{B'}) \ar[d]^{\pi'} \ar[l]^h \\
(*, B) & (*, B') \ar[l]_f
}
$$
Then $L\pi_! \circ Lh^* = Lf^* \circ L\pi'_!$.
\end{lemma}

\begin{proof}
Both functors are right adjoint to the obvious functor
$D(B') \to D(\underline{B})$.
\end{proof}

\begin{lemma}
\label{lemma-compute-by-cosimplicial-resolution}
Notation and assumptions as in Example \ref{example-category-to-point}.
Let $U_\bullet$ be a cosimplicial object in $\mathcal{C}$ such that
for every $U \in \Ob(\mathcal{C})$ the simplicial set
$\Mor_\mathcal{C}(U_\bullet, U)$
is homotopy equivalent to the constant simplicial set on a singleton. Then
$$
L\pi_!(\mathcal{F}) = \mathcal{F}(U_\bullet)
$$
in $D(\textit{Ab})$, resp.\ $D(B)$ functorially in $\mathcal{F}$ in
$\textit{Ab}(\mathcal{C})$, resp.\ $\textit{Mod}(\underline{B})$.
\end{lemma}

\begin{proof}
As $L\pi_!$ agrees for modules and abelian sheaves by
Lemma \ref{lemma-properties-lower-shriek-fibred-category}
it suffices to prove this when $\mathcal{F}$ is an abelian sheaf.
For $U \in \Ob(\mathcal{C})$ the abelian sheaf $j_{U!}\mathbf{Z}_U$
is a projective object of $\textit{Ab}(\mathcal{C})$ since
$\Hom(j_{U!}\mathbf{Z}_U, \mathcal{F}) = \mathcal{F}(U)$
and taking sections is an exact functor as the topology is chaotic.
Every abelian sheaf is a quotient of a direct sum of $j_{U!}\mathbf{Z}_U$
by Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat}.
Thus we can compute $L\pi_!(\mathcal{F})$ by choosing a resolution
$$
\ldots \to \mathcal{G}^{-1} \to \mathcal{G}^0 \to \mathcal{F} \to 0
$$
whose terms are direct sums of sheaves of the form above and taking
$L\pi_!(\mathcal{F}) = \pi_!(\mathcal{G}^\bullet)$. Consider the
double complex
$A^{\bullet, \bullet} = \mathcal{G}^\bullet(U_\bullet)$.
The map $\mathcal{G}^0 \to \mathcal{F}$ gives a map of complexes
$A^{0, \bullet} \to \mathcal{F}(U_\bullet)$.
Since $\pi_!$ is computed by taking the colimit over
$\mathcal{C}^{opp}$ (Lemma \ref{lemma-compute-pi-shriek})
we see that the two compositions
$\mathcal{G}^m(U_1) \to \mathcal{G}^m(U_0) \to \pi_!\mathcal{G}^m$
are equal. Thus we obtain a canonical map of complexes
$$
\text{Tot}(A^{\bullet, \bullet})
\longrightarrow
\pi_!(\mathcal{G}^\bullet) = L\pi_!(\mathcal{F})
$$
To prove the lemma it suffices to show that the complexes
$$
\ldots \to \mathcal{G}^m(U_1) \to \mathcal{G}^m(U_0) \to
\pi_!\mathcal{G}^m \to 0
$$
are exact, see Homology, Lemma
\ref{homology-lemma-double-complex-gives-resolution}.
Since the sheaves $\mathcal{G}^m$ are direct sums of the sheaves
$j_{U!}\mathbf{Z}_U$ we reduce to $\mathcal{G} = j_{U!}\mathbf{Z}_U$.
The complex $j_{U!}\mathbf{Z}_U(U_\bullet)$
is the complex of abelian groups associated to the free
$\mathbf{Z}$-module on the simplicial set
$\Mor_\mathcal{C}(U_\bullet, U)$ which we assumed to be homotopy
equivalent to a singleton. We conclude that
$$
j_{U!}\mathbf{Z}_U(U_\bullet) \to \mathbf{Z}
$$
is a homotopy equivalence of abelian groups hence a quasi-isomorphism
(Simplicial, Remark \ref{simplicial-remark-homotopy-better} and
Lemma \ref{simplicial-lemma-homotopy-s-N}). This finishes the proof
since $\pi_!j_{U!}\mathbf{Z}_U = \mathbf{Z}$
as was shown in the proof of
Lemma \ref{lemma-properties-lower-shriek-fibred-category}.
\end{proof}

\begin{lemma}
\label{lemma-get-it-now}
Notation and assumptions as in Example \ref{example-morphism-categories}.
If there exists a cosimplicial object $U'_\bullet$ of $\mathcal{C}'$
such that Lemma \ref{lemma-compute-by-cosimplicial-resolution}
applies to both $U'_\bullet$ in $\mathcal{C}'$
and $u(U'_\bullet)$ in $\mathcal{C}$, then we have
$L\pi'_! \circ g^{-1} = L\pi_!$ as functors
$D(\mathcal{C}) \to D(\textit{Ab})$,
resp.\ $D(\mathcal{C}, \underline{B}) \to D(B)$.
\end{lemma}

\begin{proof}
Follows immediately from
Lemma \ref{lemma-compute-by-cosimplicial-resolution}
and the fact that $g^{-1}$ is given by precomposing with $u$.
\end{proof}

\begin{lemma}
\label{lemma-product-categories}
Let $\mathcal{C}_i$, $i = 1, 2$ be categories. Let
$u_i : \mathcal{C}_1 \times \mathcal{C}_2 \to \mathcal{C}_i$ be the
projection functors. Let $B$ be a ring. Let
$g_i : (\Sh(\mathcal{C}_1 \times \mathcal{C}_2), \underline{B}) \to
(\Sh(\mathcal{C}_i), \underline{B})$ be the corresponding morphisms
of ringed topoi, see Example \ref{example-morphism-categories}. For
$K_i \in D(\mathcal{C}_i, B)$ we have
$$
L(\pi_1 \times \pi_2)_!(
g_1^{-1}K_1 \otimes_{\underline{B}}^\mathbf{L} g_2^{-1}K_2)
=
L\pi_{1, !}(K_1) \otimes_B^\mathbf{L} L\pi_{2, !}(K_2)
$$
in $D(B)$ with obvious notation.
\end{lemma}

\begin{proof}
As both sides commute with colimits, it suffices to prove this for
$K_1 = j_{U!}\underline{B}_U$ and $K_2 = j_{V!}\underline{B}_V$
for $U \in \Ob(\mathcal{C}_1)$ and $V \in \Ob(\mathcal{C}_2)$.
See construction of $L\pi_!$ in
Lemma \ref{lemma-existence-derived-lower-shriek}.
In this case
$$
g_1^{-1}K_1 \otimes_{\underline{B}}^\mathbf{L} g_2^{-1}K_2 =
g_1^{-1}K_1 \otimes_{\underline{B}} g_2^{-1}K_2 =
j_{(U, V)!}\underline{B}_{(U, V)}
$$
Verification omitted. Hence the result follows as both the left and
the right hand side of the formula of the lemma evaluate to $B$, see
construction of $L\pi_!$ in Lemma \ref{lemma-existence-derived-lower-shriek}.
\end{proof}

\begin{lemma}
\label{lemma-eilenberg-zilber}
Notation and assumptions as in Example \ref{example-category-to-point}.
If there exists a cosimplicial object $U_\bullet$ of $\mathcal{C}$
such that Lemma \ref{lemma-compute-by-cosimplicial-resolution}
applies, then
$$
L\pi_!(K_1 \otimes^\mathbf{L}_{\underline{B}} K_2) =
L\pi_!(K_1) \otimes^\mathbf{L}_B L\pi_!(K_2)
$$
for all $K_i \in D(\underline{B})$.
\end{lemma}

\begin{proof}
Consider the diagram of categories and functors
$$
\xymatrix{
& & \mathcal{C} \\
\mathcal{C} \ar[r]^-u &
\mathcal{C} \times \mathcal{C} \ar[rd]^{u_2} \ar[ru]_{u_1} \\
& & \mathcal{C}
}
$$
where $u$ is the diagonal functor and $u_i$ are the projection functors.
This gives morphisms of ringed topoi $g$, $g_1$, $g_2$.
For any object $(U_1, U_2)$ of $\mathcal{C}$ we have
$$
\Mor_{\mathcal{C} \times \mathcal{C}}(u(U_\bullet), (U_1, U_2)) =
\Mor_\mathcal{C}(U_\bullet, U_1) \times \Mor_\mathcal{C}(U_\bullet, U_2)
$$
which is homotopy equivalent to a point by
Simplicial, Lemma \ref{simplicial-lemma-products-homotopy}.
Thus Lemma \ref{lemma-get-it-now} gives
$L\pi_!(g^{-1}K) = L(\pi \times \pi)_!(K)$ for any $K$ in
$D(\mathcal{C} \times \mathcal{C}, B)$.
Take $K = g_1^{-1}K_1 \otimes_B^\mathbf{L} g_2^{-1}K_2$.
Then $g^{-1}K = K_1 \otimes^\mathbf{L}_{\underline{B}} K_2$
because $g^{-1} = g^* = Lg^*$ commutes with derived tensor product
(Lemma \ref{lemma-pullback-tensor-product}).
To finish we apply Lemma \ref{lemma-product-categories}.
\end{proof}

\begin{remark}[Simplicial modules]
\label{remark-simplicial-modules}
Let $\mathcal{C} = \Delta$ and let $B$ be any ring. This is a special
case of Example \ref{example-category-to-point} where the assumptions
of Lemma \ref{lemma-compute-by-cosimplicial-resolution} hold.
Namely, let $U_\bullet$ be the cosimplicial object of $\Delta$ given by
the identity functor. To verify the condition we have to show that for
$[m] \in \Ob(\Delta)$ the simplicial set
$\Delta[m] : n \mapsto \Mor_\Delta([n], [m])$ is homotopy equivalent
to a point. This is explained in
Simplicial, Example \ref{simplicial-example-simplex-contractible}.

\medskip\noindent
In this situation the category $\textit{Mod}(\underline{B})$
is just the category of simplicial $B$-modules and the
functor $L\pi_!$ sends a simplicial $B$-module $M_\bullet$ to its associated
complex $s(M_\bullet)$ of $B$-modules. Thus the results above can be
reinterpreted in terms of results on simplicial modules. For example
a special case of Lemma \ref{lemma-eilenberg-zilber} is:
if $M_\bullet$, $M'_\bullet$ are flat simplicial
$B$-modules, then the complex $s(M_\bullet \otimes_B M'_\bullet)$ is
quasi-isomorphic to the total complex associated to the double complex
$s(M_\bullet) \otimes_B s(M'_\bullet)$.
(Hint: use flatness to convert from derived tensor products to usual
tensor products.)
This is a special case of the Eilenberg-Zilber theorem
which can be found in \cite{Eilenberg-Zilber}.
\end{remark}

\begin{lemma}
\label{lemma-O-homology-qis}
Let $\mathcal{C}$ be a category (endowed with chaotic topology).
Let $\mathcal{O} \to \mathcal{O}'$ be a map of sheaves of rings on
$\mathcal{C}$. Assume
\begin{enumerate}
\item there exists a cosimplicial object $U_\bullet$ in $\mathcal{C}$
as in Lemma \ref{lemma-compute-by-cosimplicial-resolution}, and
\item $L\pi_!\mathcal{O} \to L\pi_!\mathcal{O}'$ is an isomorphism.
\end{enumerate}
For $K$ in $D(\mathcal{O})$ we have
$$
L\pi_!(K) = L\pi_!(K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}')
$$
in $D(\textit{Ab})$.
\end{lemma}

\begin{proof}
Note: in this proof $L\pi_!$ denotes the left derived functor
of $\pi_!$ on abelian sheaves.
Since $L\pi_!$ commutes with colimits, it suffices
to prove this for bounded above complexes of $\mathcal{O}$-modules
(compare with argument of
Derived Categories, Proposition \ref{derived-proposition-left-derived-exists}
or just stick to bounded above complexes).
Every such complex is quasi-isomorphic to a bounded above complex
whose terms are direct sums of $j_{U!}\mathcal{O}_U$ with
$U \in \Ob(\mathcal{C})$, see
Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat}.
Thus it suffices to prove the lemma
for $j_{U!}\mathcal{O}_U$. By assumption
$$
S_\bullet = \Mor_\mathcal{C}(U_\bullet, U)
$$
is a simplicial set homotopy equivalent to the constant simplicial
set on a singleton. Set $P_n = \mathcal{O}(U_n)$ and
$P'_n = \mathcal{O}'(U_n)$. Observe that the complex associated to the
simplicial abelian group
$$
X_\bullet : n \longmapsto \bigoplus\nolimits_{s \in S_n} P_n
$$
computes $L\pi_!(j_{U!}\mathcal{O}_U)$ by
Lemma \ref{lemma-compute-by-cosimplicial-resolution}.
Since $j_{U!}\mathcal{O}_U$ is a flat $\mathcal{O}$-module we have
$j_{U!}\mathcal{O}_U \otimes^\mathbf{L}_\mathcal{O} \mathcal{O}' =
j_{U!}\mathcal{O}'_U$ and $L\pi_!$ of this is computed by the complex
associated to the simplicial abelian group
$$
X'_\bullet : n \longmapsto \bigoplus\nolimits_{s \in S_n} P'_n
$$
As the rule which to a simplicial set $T_\bullet$ associated the simplicial
abelian group with terms $\bigoplus_{t \in T_n} P_n$ is a functor, we see
that $X_\bullet \to P_\bullet$ is a homotopy equivalence of simplicial
abelian groups. Similarly, the rule which to a simplicial set
$T_\bullet$ associates the simplicial abelian group with terms
$\bigoplus_{t \in T_n} P'_n$ is a functor. Hence $X'_\bullet \to P'_\bullet$
is a homotopy equivalence of simplicial abelian groups.
By assumption $P_\bullet \to P'_\bullet$ is a quasi-isomorphism
(since $P_\bullet$, resp.\ $P'_\bullet$ computes $L\pi_!\mathcal{O}$,
resp. $L\pi_!\mathcal{O}'$ by
Lemma \ref{lemma-compute-by-cosimplicial-resolution}).
We conclude that $X_\bullet$ and $X'_\bullet$ are quasi-isomorphic as desired.
\end{proof}

\begin{remark}
\label{remark-O-homology-B-homology-general}
Let $\mathcal{C}$ and $B$ be as in Example \ref{example-category-to-point}.
Assume there exists a cosimplicial object as in
Lemma \ref{lemma-compute-by-cosimplicial-resolution}.
Let $\mathcal{O} \to \underline{B}$ be a map sheaf of rings on
$\mathcal{C}$ which induces an isomorphism
$L\pi_!\mathcal{O} \to L\pi_!\underline{B}$.
In this case we obtain an exact functor of triangulated categories
$$
L\pi_! : D(\mathcal{O}) \longrightarrow D(B)
$$
Namely, for any object $K$ of $D(\mathcal{O})$ we have
$L\pi^{\textit{Ab}}_!(K) =
L\pi^{\textit{Ab}}_!(K \otimes_{\mathcal{O}}^\mathbf{L} \underline{B})$
by Lemma \ref{lemma-O-homology-qis}.
Thus we can define the displayed functor as the composition of
$- \otimes^\mathbf{L}_\mathcal{O} \underline{B}$ with the functor
$L\pi_! : D(\underline{B}) \to D(B)$.
In other words, we obtain a $B$-module structure on $L\pi_!(K)$ coming
from the (canonical, functorial) identification of $L\pi_!(K)$ with
$L\pi_!(K \otimes_\mathcal{O}^\mathbf{L} \underline{B})$ of the lemma.
\end{remark}







\section{Calculating derived lower shriek}
\label{section-calculate}

\noindent
In this section we apply the results from
Section \ref{section-homology}
to compute
$L\pi_!$ in Situation \ref{situation-fibred-category} and
$Lg_!$ in Situation \ref{situation-morphism-fibred-categories}.

\begin{lemma}
\label{lemma-compute-left-derived-pi-shriek-pre}
Assumptions and notation as in Situation \ref{situation-fibred-category}.
For $\mathcal{F}$ in $\textit{PAb}(\mathcal{C})$ and $n \geq 0$
consider the abelian sheaf $L_n(\mathcal{F})$ on $\mathcal{D}$
which is the sheaf associated to the presheaf
$$
V \longmapsto H_n(\mathcal{C}_V, \mathcal{F}|_{\mathcal{C}_V})
$$
with restriction maps as indicated in the proof. Then
$L_n(\mathcal{F}) = L_n(\mathcal{F}^\#)$.
\end{lemma}

\begin{proof}
For a morphism $h : V' \to V$ of $\mathcal{D}$ there is a
pullback functor $h^* : \mathcal{C}_V \to \mathcal{C}_{V'}$ of fibre
categories (Categories, Definition
\ref{categories-definition-pullback-functor-fibred-category}).
Moreover for $U \in \Ob(\mathcal{C}_V)$ there is a
strongly cartesian morphism $h^*U \to U$ covering $h$.
Restriction along these strongly cartesian morphisms defines a
transformation of functors
$$
\mathcal{F}|_{\mathcal{C}_V}
\longrightarrow
\mathcal{F}|_{\mathcal{C}_{V'}} \circ h^*.
$$
By Example \ref{example-morphism-categories}
we obtain the desired restriction map
$$
H_n(\mathcal{C}_V, \mathcal{F}|_{\mathcal{C}_V})
\longrightarrow
H_n(\mathcal{C}_{V'}, \mathcal{F}|_{\mathcal{C}_{V'}})
$$
Let us denote $L_{n, p}(\mathcal{F})$ this presheaf, so that
$L_n(\mathcal{F}) = L_{n, p}(\mathcal{F})^\#$.
The canonical map $\gamma : \mathcal{F} \to \mathcal{F}^+$
(Sites, Theorem \ref{sites-theorem-plus})
defines a canonical
map $L_{n, p}(\mathcal{F}) \to L_{n, p}(\mathcal{F}^+)$.
We have to prove this map becomes an isomorphism after sheafification.

\medskip\noindent
Let us use the computation of homology given in
Example \ref{example-left-derived-colimits}. Denote
$K_\bullet(\mathcal{F}|_{\mathcal{C}_V})$ the complex associated to
the restriction of $\mathcal{F}$ to the fibre category $\mathcal{C}_V$.
By the remarks above we obtain a presheaf $K_\bullet(\mathcal{F})$
of complexes
$$
V \longmapsto K_\bullet(\mathcal{F}|_{\mathcal{C}_V})
$$
whose cohomology presheaves are the presheaves $L_{n, p}(\mathcal{F})$.
Thus it suffices to show that
$$
K_\bullet(\mathcal{F}) \longrightarrow K_\bullet(\mathcal{F}^+)
$$
becomes an isomorphism on sheafification.

\medskip\noindent
Injectivity. Let $V$ be an object of $\mathcal{D}$ and let
$\xi \in K_n(\mathcal{F})(V)$ be an element which maps
to zero in $K_n(\mathcal{F}^+)(V)$. We have to show there exists a
covering $\{V_j \to V\}$ such that $\xi|_{V_j}$ is zero in
$K_n(\mathcal{F})(V_j)$. We write
$$
\xi = \sum (U_{i, n + 1} \to \ldots \to U_{i, 0}, \sigma_i)
$$
with $\sigma_i \in \mathcal{F}(U_{i, 0})$. We arrange it so that
each sequence of morphisms $U_n \to \ldots \to U_0$ of $\mathcal{C}_V$
occurs are most once. Since the sums in the definition
of the complex $K_\bullet$ are direct sums, the only way this can map
to zero in $K_\bullet(\mathcal{F}^+)(V)$ is if all $\sigma_i$ map
to zero in $\mathcal{F}^+(U_{i, 0})$. By construction of
$\mathcal{F}^+$ there exist coverings $\{U_{i, 0, j} \to U_{i, 0}\}$
such that $\sigma_i|_{U_{i, 0, j}}$ is zero. By our construction of
the topology on $\mathcal{C}$ we can write $U_{i, 0, j} \to U_{i, 0}$
as the pullback (Categories, Definition
\ref{categories-definition-pullback-functor-fibred-category})
of some morphisms $V_{i, j} \to V$ and moreover each
$\{V_{i, j} \to V\}$ is a covering. Choose a covering
$\{V_j \to V\}$ dominating each of the coverings $\{V_{i, j} \to V\}$.
Then it is clear that $\xi|_{V_j} = 0$.

\medskip\noindent
Surjectivity. Proof omitted. Hint: Argue as in the proof of
injectivity.
\end{proof}

\begin{lemma}
\label{lemma-compute-left-derived-pi-shriek}
Assumptions and notation as in Situation \ref{situation-fibred-category}.
For $\mathcal{F}$ in $\textit{Ab}(\mathcal{C})$ and $n \geq 0$
the sheaf $L_n\pi_!(\mathcal{F})$ is equal to the sheaf
$L_n(\mathcal{F})$ constructed in
Lemma \ref{lemma-compute-left-derived-pi-shriek-pre}.
\end{lemma}

\begin{proof}
Consider the sequence of functors $\mathcal{F} \mapsto L_n(\mathcal{F})$
from $\textit{PAb}(\mathcal{C}) \to \textit{Ab}(\mathcal{C})$.
Since for each $V \in \Ob(\mathcal{D})$ the sequence of functors
$H_n(\mathcal{C}_V, - )$ forms a $\delta$-functor
so do the functors $\mathcal{F} \mapsto L_n(\mathcal{F})$.
Our goal is to show these form a universal $\delta$-functor.
In order to do this we construct some abelian presheaves
on which these functors vanish.

\medskip\noindent
For $U' \in \Ob(\mathcal{C})$ consider the abelian presheaf
$\mathcal{F}_{U'} = j_{U'!}^{\textit{PAb}}\mathbf{Z}_{U'}$
(Modules on Sites, Remark \ref{sites-modules-remark-localize-presheaves}).
Recall that
$$
\mathcal{F}_{U'}(U) =
\bigoplus\nolimits_{\Mor_\mathcal{C}(U, U')} \mathbf{Z}
$$
If $U$ lies over $V = p(U)$ in $\mathcal{D})$ and $U'$ lies over $V' = p(U')$
then any morphism $a : U \to U'$ factors uniquely as $U \to h^*U' \to U'$
where $h = p(a) : V \to V'$ (see
Categories, Definition
\ref{categories-definition-pullback-functor-fibred-category}).
Hence we see that
$$
\mathcal{F}_{U'}|_{\mathcal{C}_V}
=
\bigoplus\nolimits_{h \in \Mor_\mathcal{D}(V, V')}
j_{h^*U'!}\mathbf{Z}_{h^*U'}
$$
where $j_{h^*U'} : \Sh(\mathcal{C}_V/h^*U') \to \Sh(\mathcal{C}_V)$
is the localization morphism. The sheaves $j_{h^*U'!}\mathbf{Z}_{h^*U'}$
have vanishing higher homology groups (see
Example \ref{example-left-derived-colimits}).
We conclude that $L_n(\mathcal{F}_{U'}) = 0$ for all $n > 0$ and all $U'$.
It follows that any abelian presheaf $\mathcal{F}$ is a quotient
of an abelian presheaf $\mathcal{G}$ with $L_n(\mathcal{G}) = 0$ for
all $n > 0$ (Modules on Sites, Lemma
\ref{sites-modules-lemma-module-quotient-flat}).
Since $L_n(\mathcal{F}) = L_n(\mathcal{F}^\#)$ we see
that the same thing is true for abelian sheaves. Thus
the sequence of functors $L_n(-)$ is a universal delta functor
on $\textit{Ab}(\mathcal{C})$
(Homology, Lemma \ref{homology-lemma-efface-implies-universal}).
Since we have agreement with
$H^{-n}(L\pi_!(-))$ for $n = 0$ by
Lemma \ref{lemma-compute-pi-shriek}
we conclude by uniqueness of universal $\delta$-functors
(Homology, Lemma \ref{homology-lemma-uniqueness-universal-delta-functor})
and
Derived Categories, Lemma \ref{derived-lemma-right-derived-delta-functor}.
\end{proof}

\begin{lemma}
\label{lemma-compute-left-derived-g-shriek}
Assumptions and notation as in
Situation \ref{situation-morphism-fibred-categories}.
For an abelian sheaf $\mathcal{F}'$ on $\mathcal{C}'$ the sheaf
$L_ng_!(\mathcal{F}')$ is the sheaf associated to the presheaf
$$
U \longmapsto H_n(\mathcal{I}_U, \mathcal{F}'_U)
$$
For notation and restriction maps see proof.
\end{lemma}

\begin{proof}
Say $p(U) = V$. The category $\mathcal{I}_U$ is the category of pairs
$(U', \varphi)$ where $\varphi : U \to u(U')$ is a morphism of $\mathcal{C}$
with $p(\varphi) = \text{id}_V$, i.e., $\varphi$ is a morphism of the
fibre category $\mathcal{C}_V$. Morphisms
$(U'_1, \varphi_1) \to (U'_2, \varphi_2)$ are given by morphisms
$a : U'_1 \to U'_2$ of the fibre category $\mathcal{C}'_V$ such that
$\varphi_2 = u(a) \circ \varphi_1$. The presheaf $\mathcal{F}'_U$ sends
$(U', \varphi)$ to $\mathcal{F}'(U')$.
We will construct the restriction mappings below.

\medskip\noindent
Choose a factorization
$$
\xymatrix{
\mathcal{C}' \ar@<1ex>[r]^{u'} &
\mathcal{C}'' \ar[r]^{u''} \ar@<1ex>[l]^w & \mathcal{C}
}
$$
of $u$ as in
Categories, Lemma \ref{categories-lemma-ameliorate-morphism-fibred-categories}.
Then $g_! = g''_! \circ g'_!$ and similarly for derived functors.
On the other hand, the functor $g'_!$ is exact, see
Modules on Sites, Lemma \ref{sites-modules-lemma-have-left-adjoint}.
Thus we get $Lg_!(\mathcal{F}') = Lg''_!(\mathcal{F}'')$ where
$\mathcal{F}'' = g'_!\mathcal{F}'$. Note that
$\mathcal{F}'' = h^{-1}\mathcal{F}'$ where
$h : \Sh(\mathcal{C}'') \to \Sh(\mathcal{C}')$ is the morphism of topoi
associated to $w$, see
Sites, Lemma \ref{sites-lemma-have-left-adjoint}.
The functor $u''$ turns $\mathcal{C}''$ into a fibred category
over $\mathcal{C}$, hence
Lemma \ref{lemma-compute-left-derived-pi-shriek}
applies to the computation of $L_ng''_!$. The result follows as the
construction of $\mathcal{C}''$ in the proof of
Categories, Lemma \ref{categories-lemma-ameliorate-morphism-fibred-categories}
shows that the fibre category $\mathcal{C}''_U$ is equal to
$\mathcal{I}_U$. Moreover, $h^{-1}\mathcal{F}'|_{\mathcal{C}''_U}$
is given by the rule described above
(as $w$ is continuous and cocontinuous by
Stacks, Lemma \ref{stacks-lemma-topology-inherited-functorial}
so we may apply
Sites, Lemma \ref{sites-lemma-when-shriek}).
\end{proof}








\section{Simplicial modules}
\label{section-simplicial-modules}

\noindent
Let $A_\bullet$ be a simplicial ring. Recall that we may think of $A_\bullet$
as a sheaf on $\Delta$ (endowed with the chaotic topology), see
Simplicial, Section \ref{simplicial-section-simplicial-presheaves}.
Then a simplicial module $M_\bullet$ over $A_\bullet$ is just a sheaf of
$A_\bullet$-modules on $\Delta$. In other words, for every $n \geq 0$ we have
an $A_n$-module $M_n$ and for every map $\varphi : [n] \to [m]$ we have
a corresponding map
$$
M_\bullet(\varphi) : M_m \longrightarrow M_n
$$
which is $A_\bullet(\varphi)$-linear such that these maps compose in the
usual manner.

\medskip\noindent
Let $\mathcal{C}$ be a site. A {\it simplicial sheaf of rings}
$\mathcal{A}_\bullet$ on $\mathcal{C}$
is a simplicial object in the category of sheaves of rings on $\mathcal{C}$.
In this case the assignment $U \mapsto \mathcal{A}_\bullet(U)$ is a sheaf
of simplicial rings and in fact the two notions are equivalent.
A similar discussion holds for simplicial abelian sheaves, simplicial
sheaves of Lie algebras, and so on.

\medskip\noindent
However, as in the case of simplicial rings above, there is another way
to think about simplicial sheaves. Namely, consider the projection
$$
p : \Delta \times \mathcal{C} \longrightarrow \mathcal{C}
$$
This defines a fibred category with strongly cartesian morphisms
exactly the morphisms of the form $([n], U) \to ([n], V)$. We endow the category
$\Delta \times \mathcal{C}$ with the topology inherited from $\mathcal{C}$
(see Stacks, Section \ref{stacks-section-topology}). The simple description
of the coverings in $\Delta \times \mathcal{C}$
(Stacks, Lemma \ref{stacks-lemma-topology-inherited}) immediately
implies that a simplicial sheaf of rings on $\mathcal{C}$ is the
same thing as a sheaf of rings on $\Delta \times \mathcal{C}$.

\medskip\noindent
By analogy with the case of simplicial modules over a simplicial
ring, we define simplicial modules over simplicial sheaves of rings
as follows.

\begin{definition}
\label{definition-simplicial-module}
Let $\mathcal{C}$ be a site. Let $\mathcal{A}_\bullet$ be a simplicial
sheaf of rings on $\mathcal{C}$. A
{\it simplicial $\mathcal{A}_\bullet$-module} $\mathcal{F}_\bullet$
(sometimes called a
{\it simplicial sheaf of $\mathcal{A}_\bullet$-modules})
is a sheaf of modules over the sheaf of rings on $\Delta \times \mathcal{C}$
associated to $\mathcal{A}_\bullet$.
\end{definition}

\noindent
We obtain a category $\textit{Mod}(\mathcal{A}_\bullet)$ of
simplicial modules and a corresponding derived category
$D(\mathcal{A}_\bullet)$. Given a map
$\mathcal{A}_\bullet \to \mathcal{B}_\bullet$ of simplicial sheaves
of rings we obtain a functor
$$
- \otimes^\mathbf{L}_{\mathcal{A}_\bullet} \mathcal{B}_\bullet :
D(\mathcal{A}_\bullet)
\longrightarrow
D(\mathcal{B}_\bullet)
$$
Moreover, the material of the preceding sections determines a functor
$$
L\pi_! : D(\mathcal{A}_\bullet) \longrightarrow D(\mathcal{C})
$$
Given a simplicial module $\mathcal{F}_\bullet$ the object
$L\pi_!(\mathcal{F}_\bullet)$ is represented by the associated
chain complex $s(\mathcal{F}_\bullet)$
(Simplicial, Section \ref{simplicial-section-complexes}).
This follows from 
Lemmas \ref{lemma-compute-left-derived-pi-shriek} and
\ref{lemma-compute-by-cosimplicial-resolution}.

\begin{lemma}
\label{lemma-base-change-by-qis}
Let $\mathcal{C}$ be a site. Let $\mathcal{A}_\bullet \to \mathcal{B}_\bullet$
be a homomorphism of simplicial sheaves of rings on $\mathcal{C}$.
If $L\pi_!\mathcal{A}_\bullet \to L\pi_!\mathcal{B}_\bullet$ is an
isomorphism in $D(\mathcal{C})$, then we have
$$
L\pi_!(K) =
L\pi_!(K \otimes^\mathbf{L}_{\mathcal{A}_\bullet} \mathcal{B}_\bullet)
$$
for all $K$ in $D(\mathcal{A}_\bullet)$.
\end{lemma}

\begin{proof}
Let $([n], U)$ be an object of $\Delta \times \mathcal{C}$. Since $L\pi_!$
commutes with colimits, it suffices to prove this for bounded above complexes
of $\mathcal{O}$-modules (compare with argument of
Derived Categories, Proposition \ref{derived-proposition-left-derived-exists}
or just stick to bounded above complexes). Every such complex is
quasi-isomorphic to a bounded above complex whose terms are flat modules, see
Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat}.
Thus it suffices to prove the lemma for a flat $\mathcal{A}_\bullet$-module
$\mathcal{F}$. In this case the derived tensor product is the usual
tensor product and is a sheaf also. Hence by
Lemma \ref{lemma-compute-left-derived-pi-shriek}
we can compute the cohomology
sheaves of both sides of the equation by the procedure of
Lemma \ref{lemma-compute-left-derived-pi-shriek-pre}.
Thus it suffices to prove the result for the restriction of
$\mathcal{F}$ to the fibre categories (i.e., to $\Delta \times U$).
In this case the result follows from Lemma \ref{lemma-O-homology-qis}.
\end{proof}

\begin{remark}
\label{remark-homology-augmentation}
Let $\mathcal{C}$ be a site. Let
$\epsilon : \mathcal{A}_\bullet \to \mathcal{O}$ be an augmentation
(Simplicial, Definition \ref{simplicial-definition-augmentation})
in the category of sheaves of rings.
Assume $\epsilon$ induces a quasi-isomorphism
$s(\mathcal{A}_\bullet) \to \mathcal{O}$.
In this case we obtain an exact functor of triangulated categories
$$
L\pi_! : D(\mathcal{A}_\bullet) \longrightarrow D(\mathcal{O})
$$
Namely, for any object $K$ of $D(\mathcal{A}_\bullet)$ we have
$L\pi_!(K) = L\pi_!(K \otimes_{\mathcal{A}_\bullet}^\mathbf{L} \mathcal{O})$
by Lemma \ref{lemma-base-change-by-qis}.
Thus we can define the displayed functor as the composition of
$- \otimes^\mathbf{L}_{\mathcal{A}_\bullet} \mathcal{O}$ with the functor
$L\pi_! : D(\Delta \times \mathcal{C}, \pi^{-1}\mathcal{O}) \to
D(\mathcal{O})$ of Remark \ref{remark-fibred-category}.
In other words, we obtain a $\mathcal{O}$-module structure on $L\pi_!(K)$
coming from the (canonical, functorial) identification of $L\pi_!(K)$ with
$L\pi_!(K \otimes_{\mathcal{A}_\bullet}^\mathbf{L} \mathcal{O})$ of the lemma.
\end{remark}






\section{Cohomology on a category}
\label{section-cohomology}

\noindent
In the situation of Example \ref{example-category-to-point}
in addition to the derived functor $L\pi_!$, we also have the functor
$R\pi_*$. For an abelian sheaf $\mathcal{F}$ on $\mathcal{C}$
we have $H_n(\mathcal{C}, \mathcal{F}) = H^{-n}(L\pi_!\mathcal{F})$
and $H^n(\mathcal{C}, \mathcal{F}) = H^n(R\pi_*\mathcal{F})$.

\begin{example}[Computing cohomology]
\label{example-right-derived-limits}
In Example \ref{example-category-to-point} we can compute
the functors $H^n(\mathcal{C}, -)$ as follows. Let
$\mathcal{F} \in \Ob(\textit{Ab}(\mathcal{C}))$.
Consider the cochain complex
$$
K^\bullet(\mathcal{F}) :
\prod\nolimits_{U_0} \mathcal{F}(U_0)
\to
\prod\nolimits_{U_0 \to U_1} \mathcal{F}(U_0)
\to
\prod\nolimits_{U_0 \to U_1 \to U_2} \mathcal{F}(U_0)
\to \ldots
$$
where the transition maps are given by
$$
(s_{U_0 \to U_1})
\longmapsto
((U_0 \to U_1 \to U_2) \mapsto s_{U_0 \to U_1} - s_{U_0 \to U_2}
+ s_{U_1 \to U_2}|_{U_0})
$$
and similarly in other degrees. By construction
$$
H^0(\mathcal{C}, \mathcal{F}) =
\lim_{\mathcal{C}^{opp}} \mathcal{F} =
H^0(K^\bullet(\mathcal{F})),
$$
see Categories, Lemma \ref{categories-lemma-limits-products-equalizers}.
The construction of $K^\bullet(\mathcal{F})$ is functorial in $\mathcal{F}$
and transforms short exact sequences of $\textit{Ab}(\mathcal{C})$ into
short exact sequences of complexes. Thus the sequence of functors
$\mathcal{F} \mapsto H^n(K^\bullet(\mathcal{F}))$ forms a $\delta$-functor, see
Homology, Definition \ref{homology-definition-cohomological-delta-functor} and
Lemma \ref{homology-lemma-long-exact-sequence-cochain}.
For an object $U$ of $\mathcal{C}$ denote $p_U : \Sh(*) \to \Sh(\mathcal{C})$
the corresponding point with $p_U^{-1}$ equal to evaluation at $U$, see
Sites, Example \ref{sites-example-indiscrete-points}.
Let $A$ be an abelian group and set $\mathcal{F} = p_{U, *}A$. In this case
the complex $K^\bullet(\mathcal{F})$ is the complex with terms
$\text{Map}(X_n, A)$ where
$$
X_n = \coprod\nolimits_{U_0 \to \ldots \to U_{n - 1} \to U_n}
\Mor_\mathcal{C}(U, U_0)
$$
This simplicial set is homotopy equivalent to the constant simplicial
set on a singleton $\{*\}$. Namely, the map $X_\bullet \to \{*\}$
is obvious, the map $\{*\} \to X_n$ is given
by mapping $*$ to $(U \to \ldots \to U, \text{id}_U)$, and the
maps
$$
h_{n, i} : X_n \longrightarrow X_n
$$
(Simplicial, Lemma \ref{simplicial-lemma-relations-homotopy})
defining the homotopy between the two maps $X_\bullet \to X_\bullet$
are given by the rule
$$
h_{n, i} :
(U_0 \to \ldots \to U_n, f)
\longmapsto
(U \to \ldots \to U \to U_i \to \ldots \to U_n, \text{id})
$$
for $i > 0$ and $h_{n, 0} = \text{id}$. Verifications omitted.
Since $\text{Map}(-, A)$ is a contravariant functor, implies that
$K^\bullet(p_{U, *}A)$ has trivial cohomology in positive degrees
(by the functoriality of
Simplicial, Remark \ref{simplicial-remark-homotopy-better}
and the result of
Simplicial, Lemma \ref{simplicial-lemma-homotopy-s-Q}).
This implies that $K^\bullet(\mathcal{F})$ is acyclic in positive
degrees also if $\mathcal{F}$ is a product of sheaves of the form
$p_{U, *}A$. As every abelian sheaf on $\mathcal{C}$ embeds
into such a product we conclude that $K^\bullet(\mathcal{F})$
computes the left derived functors
$H^n(\mathcal{C}, -)$ of $H^0(\mathcal{C}, -)$
for example by
Homology, Lemma \ref{homology-lemma-efface-implies-universal}
and
Derived Categories, Lemma \ref{derived-lemma-right-derived-delta-functor}.
\end{example}

\begin{example}[Computing Exts]
\label{example-computing-exts}
In Example \ref{example-category-to-point} assume we are moreover given
a sheaf of rings $\mathcal{O}$ on $\mathcal{C}$. Let
$\mathcal{F}$, $\mathcal{G}$ be $\mathcal{O}$-modules.
Consider the complex $K^\bullet(\mathcal{G}, \mathcal{F})$
with degree $n$ term
$$
\prod\nolimits_{U_0 \to U_1 \to \ldots \to U_n}
\Hom_{\mathcal{O}(U_n)}(\mathcal{G}(U_n), \mathcal{F}(U_0))
$$
and transition map given by
$$
(\varphi_{U_0 \to U_1})
\longmapsto
((U_0 \to U_1 \to U_2) \mapsto
\varphi_{U_0 \to U_1} \circ \rho^{U_2}_{U_1}
- \varphi_{U_0 \to U_2}
+ \rho^{U_1}_{U_0} \circ \varphi_{U_1 \to U_2}
$$
and similarly in other degrees. Here the $\rho$'s indicate restriction maps.
By construction
$$
\Hom_\mathcal{O}(\mathcal{G}, \mathcal{F}) =
H^0(K^\bullet(\mathcal{G}, \mathcal{F}))
$$
for all pairs of $\mathcal{O}$-modules $\mathcal{F}, \mathcal{G}$.
The assignment
$(\mathcal{G}, \mathcal{F}) \mapsto K^\bullet(\mathcal{G}, \mathcal{F})$
is a bifunctor which transforms direct sums in the first variable into
products and commutes with products in the second variable.
We claim that
$$
\Ext^i_\mathcal{O}(\mathcal{G}, \mathcal{F}) =
H^i(K^\bullet(\mathcal{G}, \mathcal{F}))
$$
for $i \geq 0$ provided either
\begin{enumerate}
\item $\mathcal{G}(U)$ is a projective $\mathcal{O}(U)$-module
for all $U \in \Ob(\mathcal{C})$, or
\item $\mathcal{F}(U)$ is an injective $\mathcal{O}(U)$-module
for all $U \in \Ob(\mathcal{C})$.
\end{enumerate}
Namely, case (1) the functor $K^\bullet(\mathcal{G}, -)$
is an exact functor from the category of $\mathcal{O}$-modules
to the category of cochain complexes of abelian groups.
Thus, arguing as in Example \ref{example-right-derived-limits},
it suffices to show that $K^\bullet(\mathcal{G}, \mathcal{F})$
is acyclic in positive degrees when $\mathcal{F}$ is $p_{U, *}A$
for an $\mathcal{O}(U)$-module $A$.
Choose a short exact sequence
\begin{equation}
\label{equation-split}
0 \to \mathcal{G}' \to \bigoplus j_{U_i!}\mathcal{O}_{U_i} \to
\mathcal{G} \to 0
\end{equation}
see Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat}.
Since (1) holds for the middle and right sheaves, it also holds for
$\mathcal{G}'$ and evaluating (\ref{equation-split})
on an object of $\mathcal{C}$
gives a split exact sequence of modules.
We obtain a short exact sequence of complexes
$$
0 \to
K^\bullet(\mathcal{G}, \mathcal{F}) \to
\prod K^\bullet(j_{U_i!}\mathcal{O}_{U_i}, \mathcal{F}) \to
K^\bullet(\mathcal{G}', \mathcal{F}) \to 0
$$
for any $\mathcal{F}$, in particular $\mathcal{F} = p_{U, *}A$.
On $H^0$ we obtain
$$
0 \to \Hom(\mathcal{G}, p_{U, *}A) \to
\Hom(\prod j_{U_i!}\mathcal{O}_{U_i}, p_{U, *}A) \to
\Hom(\mathcal{G}', p_{U, *}A) \to 0
$$
which is exact as
$\Hom(\mathcal{H}, p_{U, *}A) = \Hom_{\mathcal{O}(U)}(\mathcal{H}(U), A)$
and the sequence of sections of (\ref{equation-split}) over $U$ is split exact.
Thus we can use dimension shifting to see that it suffices to prove
$K^\bullet(j_{U'!}\mathcal{O}_{U'}, p_{U, *}A)$ is acyclic in positive
degrees for all $U, U' \in \Ob(\mathcal{C})$. In this case
$K^n(j_{U'!}\mathcal{O}_{U'}, p_{U, *}A)$ is equal to
$$
\prod\nolimits_{U \to U_0 \to U_1 \to \ldots \to U_n \to U'} A
$$
In other words, $K^\bullet(j_{U'!}\mathcal{O}_{U'}, p_{U, *}A)$
is the complex with terms $\text{Map}(X_\bullet, A)$ where
$$
X_n = \coprod\nolimits_{U_0 \to \ldots \to U_{n - 1} \to U_n}
\Mor_\mathcal{C}(U, U_0) \times \Mor_\mathcal{C}(U_n, U')
$$
This simplicial set is homotopy equivalent to the constant simplicial
set on a singleton $\{*\}$ as can be proved in exactly the same way
as the corresponding statement in Example \ref{example-right-derived-limits}.
This finishes the proof of the claim.

\medskip\noindent
The argument in case (2) is similar (but dual).
\end{example}






\section{Modules on a category}
\label{section-modules-cohomology}

\noindent
The material in this section will be used to define a variant of the
derived category of quasi-coherent modules on a stack in groupoids
over the category of schemes. See
Sheaves on Stacks, Section \ref{stacks-sheaves-section-QC}.

\medskip\noindent
Let $\mathcal{C}$ be a category. We think of $\mathcal{C}$ as a site with
the chaotic topology. As in Example \ref{example-computing-exts} we let
$\mathcal{O}$ be a sheaf of rings on $\mathcal{C}$.
In other words, $\mathcal{O}$ is
a presheaf of rings on the category $\mathcal{C}$, see
Categories, Definition \ref{categories-definition-presheaf}.

\begin{definition}
\label{definition-cartesian}
In the situation above, we denote $\mathit{QC}(\mathcal{C}, \mathcal{O})$
or simply {\it $\mathit{QC}(\mathcal{O})$}
the full subcategory of $D(\mathcal{O}) = D(\mathcal{C}, \mathcal{O})$
consisting of objects $K$ such that
for all $U \to V$ in $\mathcal{C}$ the canonical map
$$
R\Gamma(V, K) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)
\longrightarrow
R\Gamma(U, K)
$$
is an isomorphism in $D(\mathcal{O}(U))$.
\end{definition}

\begin{lemma}
\label{lemma-cartesian-good-sub}
In the situation above, the subcategory $\mathit{QC}(\mathcal{O})$ is a
strictly full, saturated, triangulated subcategory of $D(\mathcal{O})$
preserved by arbitrary direct sums.
\end{lemma}

\begin{proof}
Let $U$ be an object of $\mathcal{C}$. Since the topology
on $\mathcal{C}$ is chaotic, the functor $\mathcal{F} \mapsto \mathcal{F}(U)$
is exact and commutes with direct sums. Hence the exact functor
$K \mapsto R\Gamma(U, K)$ is computed by representing $K$ by any complex
$\mathcal{F}^\bullet$ of $\mathcal{O}$-modules and taking
$\mathcal{F}^\bullet(U)$. Thus $R\Gamma(U, -)$ commutes with direct
sums, see Injectives, Lemma \ref{injectives-lemma-derived-products}.
Similarly, given a morphism $U \to V$ of $\mathcal{C}$
the derived tensor product functor
$- \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U) :
D(\mathcal{O}(V)) \to D(\mathcal{O}(U))$
is exact and commutes with direct sums. The lemma follows
from these observations in a straightforward manner; details omitted.
\end{proof}

\begin{lemma}
\label{lemma-QC-bounded-above}
In the situation above, suppose that $M$ is an object of
$\mathit{QC}(\mathcal{O})$ and $b \in \mathbf{Z}$ such that $H^i(M) = 0$
for all $i > b$. Then $H^b(M)$ is a quasi-coherent module on
$(\mathcal{C}, \mathcal{O})$ in the sense of
Modules on Sites, Definition \ref{sites-modules-definition-site-local}.
\end{lemma}

\begin{proof}
By Modules on Sites, Lemma \ref{sites-modules-lemma-chaotic-quasi-coherent}
it suffices to show that for every morphism $U \to V$ of
$\mathcal{C}$ the map
$$
H^p(M)(V) \otimes_{\mathcal{O}(V)} \mathcal{O}(U) \to H^b(M)(U)
$$
is an isomorphism. We are given that the map
$$
R\Gamma(V, M) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)
\to R\Gamma(U, M)
$$
is an isomorphism. Thus the result by the Tor spectral sequence for example.
Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-QC-final-object}
In the situation above, suppose that $\mathcal{C}$ has a final object $X$.
Set $R = \mathcal{O}(X)$ and denote
$f : (\mathcal{C}, \mathcal{O}) \to (pt, R)$ the obvious morphism of sites.
Then $\mathit{QC}(\mathcal{O}) = D(R)$ given by $Lf^*$ and $Rf_*$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-QC-hom-out-of}
In the situation above, suppose that $K$ is an object of
$\mathit{QC}(\mathcal{O})$ and $M$ arbitrary in $D(\mathcal{O})$.
For every object $U$ of $\mathcal{C}$ we have
$$
\Hom_{D(\mathcal{O}_U)}(K|_U, M|_U) =
R\Hom_{\mathcal{O}(U)}(R\Gamma(U, K), R\Gamma(U, M))
$$
\end{lemma}

\begin{proof}
We may replace $\mathcal{C}$ by $\mathcal{C}/U$. Thus we may assume
$U = X$ is a final object of $\mathcal{C}$. By
Lemma \ref{lemma-QC-final-object} we see that $K = Lf^*P$
where $P = R\Gamma(U, K) = R\Gamma(X, K) = Rf_*K$.
Thus the result because $Lf^*$
is the left adjoint to $Rf_*(-) = R\Gamma(U, -)$.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be as above. For a complex
$\mathcal{F}^\bullet$ of $\mathcal{O}$-modules we define the
{\it size} $|\mathcal{F}^\bullet|$ of $\mathcal{F}^\bullet$ as
$$
|\mathcal{F}^\bullet| =
\left|
\coprod\nolimits_{i \in \mathbf{Z},\ U \in \Ob(\mathcal{C})} \mathcal{F}^i(U)
\right|
$$
For an object $K$ of
$D(\mathcal{O})$ we define the {\it size} $|K|$ of $K$ to be the
cardinal
$$
|K| = \min
\left\{
\left|
\mathcal{F}^\bullet
\right|
\text{ where }\mathcal{F}^\bullet\text{ represents }K
\right\}
$$
By properties of cardinals the minimum exists.

\begin{lemma}
\label{lemma-build-from}
In the situation above, there exists a cardinal $\kappa$ with the
following property: given a complex $\mathcal{F}^\bullet$ of
$\mathcal{O}$-modules and subsets $\Omega^i_U \subset \mathcal{F}^i(U)$
there exists a subcomplex $\mathcal{H}^\bullet \subset \mathcal{F}^\bullet$
with $\Omega^i_U \subset \mathcal{H}^i(U)$ and
$|\mathcal{H}^\bullet| \leq \max(\kappa, |\bigcup \Omega^i_U|)$.
\end{lemma}

\begin{proof}
Define $\mathcal{H}^i(U)$ to be the
$\mathcal{O}(U)$-submodule of $\mathcal{F}^i(U)$
generated by the images of $\Omega^i_V$ and $\text{d}(\Omega^{i - 1}_U)$
by restriction along any morphism $f : U \to V$.
The cardinality of $\mathcal{H}^i(U)$ is bounded
by the maximum of $\aleph_0$, the cardinality of the $\mathcal{O}(U)$,
the cardinality of $\text{Arrows}(\mathcal{C})$, and $|\bigcup \Omega^i_U|$.
Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-qis-small}
In the situation above, there exists a cardinal $\kappa$ with the
following property: given a complex $\mathcal{F}^\bullet$ of
$\mathcal{O}$-modules representing an object $K$ of $D(\mathcal{O})$
there exists a subcomplex $\mathcal{H}^\bullet \subset \mathcal{F}^\bullet$
such that $\mathcal{H}^\bullet$ represents $K$ and such that
$|\mathcal{H}^\bullet| \leq \max(\kappa, |K|)$.
\end{lemma}

\begin{proof}
First, for every $i$ and $U$ we choose a subset
$\Omega^i_U \subset \Ker(\text{d} :
\mathcal{F}^i(U) \to \mathcal{F}^{i + 1}(U))$
mapping bijectively onto
$H^i(K)(U) = H^i(\mathcal{F}^\bullet(U))$.
Hence $|\Omega^i_U| \leq |K|$ as we may represent $K$ by
a complex whose size is $|K|$.
Applying Lemma \ref{lemma-build-from}
we find a subcomplex $\mathcal{S}^\bullet \subset \mathcal{F}^\bullet$
of size at most $\max(\kappa, |K|)$ containing $\Omega^i_U$
and hence such that $H^i(\mathcal{S}^\bullet) \to H^i(\mathcal{F}^\bullet)$
is a surjection of sheaves.

\medskip\noindent
We are going to inductively construct subcomplexes
$$
\mathcal{S}^\bullet =
\mathcal{S}_0^\bullet \subset
\mathcal{S}_1^\bullet \subset
\mathcal{S}_2^\bullet \subset \ldots \subset \mathcal{F}^\bullet
$$
of size $\leq \max(\kappa, |K|)$ such that
the kernel of $H^i(\mathcal{S}_n^\bullet) \to H^i(\mathcal{F}^\bullet)$
is the same as the kernel of
$H^i(\mathcal{S}_n^\bullet) \to H^i(\mathcal{S}_{n + 1}^\bullet)$.
Once this is done we can take
$\mathcal{H}^\bullet = \bigcup \mathcal{S}_n^\bullet$ as our solution.

\medskip\noindent
Construction of $\mathcal{S}_{n + 1}^\bullet$ given
$\mathcal{S}_n^\bullet$. For ever $U$ and $i$ let
$\Omega^{i - 1}_U \subset \mathcal{F}^{i - 1}(U)$ be a subset
such that $\text{d} : \mathcal{F}^{i - 1}(U) \to \mathcal{F}^i(U)$
maps $\Omega^{i - 1}_U$ bijectively onto
$$
\mathcal{S}_n^i(U) \cap
\text{Im}(\text{d} : \mathcal{F}^{i - 1}(U)\to \mathcal{F}^i(U))
$$
Observe that $|\Omega^i_U| \leq |K|$ because $\mathcal{S}_n^i(U)$
is so bounded. Then we get $\mathcal{S}_{n + 1}^\bullet$ by an
application of Lemma \ref{lemma-build-from} to the subsets
$$
\mathcal{S}^i(U) \cup \Omega^i_U \subset \mathcal{F}^i(U)
$$
and everything is clear.
\end{proof}

\begin{lemma}
\label{lemma-cartesian-colimit-kappa}
In the situation above, there exists a cardinal $\kappa$ with the following
properties:
\begin{enumerate}
\item for every nonzero object $K$ of $\mathit{QC}(\mathcal{O})$ there exists a
nonzero morphism $E \to K$ of $\mathit{QC}(\mathcal{O})$ such that
$|E| \leq \kappa$,
\item for every morphism $\alpha : E \to \bigoplus_n K_n$ of
$\mathit{QC}(\mathcal{O})$ such that $|E| \leq \kappa$, there
exist morphisms $E_n \to K_n$
in $\mathit{QC}(\mathcal{O})$ with $|E_n| \leq \kappa$
such that $\alpha$ factors through $\bigoplus E_n \to \bigoplus K_n$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\kappa$ be an upper bound for the following set of cardinals:
\begin{enumerate}
\item $|\coprod_V j_{U!}\mathcal{O}_U(V)|$ for all $U \in \Ob(\mathcal{C})$,
\item the cardinals $\kappa(\mathcal{O}(V) \to \mathcal{O}(U))$
found in More on Algebra, Lemma \ref{more-algebra-lemma-enlarge}
for all morphisms $U \to V$ in $\mathcal{C}$,
\item the cardinal found in Lemma \ref{lemma-qis-small}.
\end{enumerate}
We claim that for any complex $\mathcal{F}^\bullet$ representing an object of
$\mathit{QC}(\mathcal{O})$ and any subcomplex
$\mathcal{S}^\bullet \subset \mathcal{F}^\bullet$
with $|\mathcal{S}^\bullet| \leq \kappa$ there exists a subcomplex
$\mathcal{H}^\bullet$ of $\mathcal{F}^\bullet$ containing $\mathcal{S}^\bullet$
such that $\mathcal{H}^\bullet$ represents an object of
$\mathit{QC}(\mathcal{O})$
and such that $|\mathcal{H}^\bullet| \leq \kappa$.
In the next two paragraphs we show that the claim implies the lemma.

\medskip\noindent
As in (1) let $K$ be a nonzero object of $\mathit{QC}(\mathcal{O})$.
Say $K$ is represented by the complex
of $\mathcal{O}$-modules $\mathcal{F}^\bullet$. Then $H^i(\mathcal{F}^\bullet)$
is nonzero for some $i$. Hence there exists an object $U$ of $\mathcal{C}$
and a section $s \in \mathcal{F}^i(U)$ with $d(s) = 0$ which determines a
nonzero section of $H^i(\mathcal{F}^\bullet)$ over $U$. Then the image
of $s : j_{U!}\mathcal{O}_U[-i] \to \mathcal{F}^\bullet$ is a subcomplex
$\mathcal{S}^\bullet \subset \mathcal{F}^\bullet$ with
$|\mathcal{S}^\bullet| \leq \kappa$. Applying the claim we get
$\mathcal{H}^\bullet \to \mathcal{F}^\bullet$ in
$\mathit{QC}(\mathcal{O})$ nonzero
with $|\mathcal{H}^\bullet| \leq \kappa$. Thus (1) holds.

\medskip\noindent
Let $\alpha : E \to \bigoplus K_n$ be as in (2).
Choose any complexes $\mathcal{K}_n^\bullet$ representing $K_n$.
Then $\bigoplus \mathcal{K}_n^\bullet$ represents $\bigoplus K_n$.
By the construction of the derived category we can represent
$E$ by a complex $\mathcal{E}^\bullet$ such that $\alpha$
is represented by a morphism
$a : \mathcal{E}^\bullet \to \bigoplus \mathcal{K}_n^\bullet$
of complexes. By Lemma \ref{lemma-qis-small} and our choice of
$\kappa$ above we may assume
$|\mathcal{E}^\bullet| \leq \kappa$. By the claim
we get subcomplexes $\mathcal{E}_n^\bullet \subset \mathcal{K}_n^\bullet$
representing objects $E_n$ of
$\mathit{QC}(\mathcal{O})$ with $|E_n| \leq \kappa$
containing the image of $a_n : \mathcal{E}^\bullet \to \mathcal{K}_n^\bullet$
as desired.

\medskip\noindent
Proof of the claim. Let $\mathcal{F}^\bullet$ be a complex representing
an object of $\mathit{QC}(\mathcal{O})$ and let
$\mathcal{S}^\bullet \subset \mathcal{F}^\bullet$ be a subcomplex of
size $\leq \kappa$. We are going to inductively construct subcomplexes
$$
\mathcal{S}^\bullet = \mathcal{S}_0^\bullet \subset
\mathcal{S}_1^\bullet \subset
\mathcal{S}_2^\bullet \subset \ldots \subset \mathcal{F}^\bullet
$$
of size $\leq \kappa$ such that for every morphism $f : U \to V$
of $\mathcal{C}$ and every $i \in \mathbf{Z}$
\begin{enumerate}
\item the kernel of the arrow
$H^i(\mathcal{S}_n^\bullet(V)
\otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)) \to
H^i(\mathcal{S}_n^\bullet(U))$
maps to zero in
$H^i(\mathcal{S}_{n + 1}^\bullet(V)
\otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U))$,
\item the image of the arrow
$H^i(\mathcal{S}_n^\bullet(U)) \to H^i(\mathcal{S}_{n + 1}^\bullet(U))$
is contained in the image of
$H^i(\mathcal{S}_{n + 1}^\bullet(V)
\otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)) \to
H^i(\mathcal{S}_{n + 1}^\bullet(U))$,
\end{enumerate}
Once this is done we can set
$\mathcal{H}^\bullet = \bigcup \mathcal{S}_n^\bullet$.
Namely, since derived tensor product and taking cohomology of
complexes of modules over rings commute with filtered
colimits, the conditions (1) and (2) together will guarantee
that
$$
\mathcal{H}^\bullet(V) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)
\longrightarrow
\mathcal{H}^\bullet(U)
$$
is an isomorphism on cohomology in all degrees and hence an isomorphism
in $D(\mathcal{O}(U))$ for all $f : U \to V$ in $\mathcal{C}$.
Hence $\mathcal{H}^\bullet$ represents an object of
$\mathit{QC}(\mathcal{O})$ as desired.

\medskip\noindent
Construction of $\mathcal{S}_{n + 1}$ given $\mathcal{S}_n$.
For every morphism $f : U \to V$ of $\mathcal{C}$
we consider the commutative diagram
$$
\xymatrix{
\mathcal{S}_n^\bullet(V)
\ar[r] \ar[d] &
\mathcal{S}_n^\bullet(U) \ar[d] \\
\mathcal{F}^\bullet(V)
\ar[r] &
\mathcal{F}^\bullet(U)
}
$$
This is a diagram as in More on Algebra, Lemma \ref{more-algebra-lemma-enlarge}
for the ring map $\mathcal{O}(V) \to \mathcal{O}(U)$, i.e., the bottom row
induces an isomorphism
$$
\mathcal{F}^\bullet(V) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)
\longrightarrow
\mathcal{F}^\bullet(U)
$$
in $D(\mathcal{O}(U))$. Thus we may choose subcomplexes
$$
\mathcal{S}_n^\bullet(V) \subset M^\bullet_f \subset \mathcal{F}^\bullet(V)
\quad\text{and}\quad
\mathcal{S}_n^\bullet(U) \subset N^\bullet_f \subset \mathcal{F}^\bullet(U)
$$
as in More on Algebra, Lemma \ref{more-algebra-lemma-enlarge}
and in particular we see that $|N^i_f|, |M^i_f| \leq \kappa$. Next, we apply
Lemma \ref{lemma-build-from} using the subsets
$$
\mathcal{S}_n^i(U) \amalg \coprod\nolimits_{f : U \to V} N^i_f
\amalg \coprod\nolimits_{g : W \to U} M^i_g
\subset
\mathcal{F}^i(U)
$$
to find a subcomplex
$$
\mathcal{S}_n^\bullet \subset
\mathcal{S}_{n + 1}^\bullet \subset
\mathcal{F}^\bullet
$$
with containing those subsets and such that
$|\mathcal{S}_{n + 1}^\bullet| \leq \kappa$.
Conditions (1) and (2) hold because the corresponding statements
hold for 
$\mathcal{S}_n^\bullet(V) \subset M^\bullet_f$ and
$\mathcal{S}_n^\bullet(U) \subset N^\bullet_f$ by the construction in
More on Algebra, Lemma \ref{more-algebra-lemma-enlarge}.
Thus the proof is complete.
\end{proof}

\begin{proposition}
\label{proposition-cartesian-brown}
Let $\mathcal{C}$ be a category viewed as a site with
the chaotic topology. Let $\mathcal{O}$ be a sheaf of rings on $\mathcal{C}$.
With $\mathit{QC}(\mathcal{O})$ as in
Definition \ref{definition-cartesian} we have
\begin{enumerate}
\item $\mathit{QC}(\mathcal{O})$ is a strictly full, saturated, triangulated
subcategory of $D(\mathcal{O})$ preserved by arbitrary direct sums,
\item any contravariant cohomological functor
$H : \mathit{QC}(\mathcal{O}) \to \textit{Ab}$
which transforms direct sums into products is representable,
\item any exact functor $F : \mathit{QC}(\mathcal{O}) \to \mathcal{D}$
of triangulated categories which transforms direct sums into direct sums
has an exact right adjoint, and
\item the inclusion functor $\mathit{QC}(\mathcal{O}) \to D(\mathcal{O})$ has
an exact right adjoint.
\end{enumerate}
\end{proposition}

\begin{proof}
Part (1) is Lemma \ref{lemma-cartesian-good-sub}.
Part (2) follows from Lemma \ref{lemma-cartesian-colimit-kappa} and
Derived Categories, Lemma \ref{derived-lemma-brown-bis}.
Part (3) follows from
Lemma \ref{lemma-cartesian-colimit-kappa} and
Derived Categories, Proposition \ref{derived-proposition-brown-bis}.
Part (4) is a special case of (3).
\end{proof}

\noindent
Let $u : \mathcal{C}' \to \mathcal{C}$ be a functor between categories.
If we view $\mathcal{C}$ and $\mathcal{C}'$ as sites with the chaotic
topology, then $u$ is a continuous and cocontinuous functor. Hence
we obtain a morphism $g : \Sh(\mathcal{C}') \to \Sh(\mathcal{C})$
of topoi, see Sites, Lemma \ref{sites-lemma-cocontinuous-morphism-topoi}.
Additionally, suppose given sheaves of rings $\mathcal{O}$ on $\mathcal{C}$
and $\mathcal{O}'$ on $\mathcal{C}'$ and a map
$g^\sharp : g^{-1}\mathcal{O} \to \mathcal{O}'$.
We denote the corresponding morphism of ringed topoi simply
$g : (\Sh(\mathcal{C}'), \mathcal{O}') \to (\Sh(\mathcal{C}), \mathcal{O})$,
see Modules on Sites, Section \ref{sites-modules-section-ringed-topoi}.

\begin{lemma}
\label{lemma-cartesian-functorial}
Let $g : (\Sh(\mathcal{C}'), \mathcal{O}') \to (\Sh(\mathcal{C}), \mathcal{O})$
be as above. Then the functor $Lg^* : D(\mathcal{O}) \to D(\mathcal{O}')$
maps $\mathit{QC}(\mathcal{O})$ into $\mathit{QC}(\mathcal{O}')$.
\end{lemma}

\begin{proof}
Let $U' \in \Ob(\mathcal{C}')$ with image $U = u(U')$ in $\mathcal{C}$.
Let $pt$ denote the category with a single object and a single morphism.
Denote $(\Sh(pt), \mathcal{O}'(U'))$ and $(\Sh(pt), \mathcal{O}(U))$
the ringed topoi as indicated. Of course we identify the derived category
of modules on these ringed topoi with $D(\mathcal{O}'(U'))$ and
$D(\mathcal{O}(U))$. Then we have a commutative diagram of ringed topoi
$$
\xymatrix{
(\Sh(pt), \mathcal{O}'(U')) \ar[rr]_{U'} \ar[d] & &
(\Sh(\mathcal{C}'), \mathcal{O}') \ar[d]^g \\
(\Sh(pt), \mathcal{O}(U)) \ar[rr]^U & &
(\Sh(\mathcal{C}), \mathcal{O})
}
$$
Pullback along the lower horizontal morphism sends $K$ in $D(\mathcal{O})$
to $R\Gamma(U, K)$. Pullback by the left vertical arrow sends
$M$ to $M \otimes_{\mathcal{O}(U)}^\mathbf{L} \mathcal{O}'(U')$.
Going around the diagram either direction produces the same result
(Lemma \ref{lemma-derived-pullback-composition}) and hence we conclude
$$
R\Gamma(U', Lg^*K) =
R\Gamma(U, K) \otimes_{\mathcal{O}(U)}^\mathbf{L} \mathcal{O}'(U')
$$
Finally, let $f' : U' \to V'$ be a morphism in $\mathcal{C}'$ and
denote $f = u(f') : U = u(U') \to V = u(V')$ the image in $\mathcal{C}$.
If $K$ is in $\mathit{QC}(\mathcal{O})$ then we have
\begin{align*}
R\Gamma(V', Lg^*K) \otimes_{\mathcal{O}'(V')}^\mathbf{L} \mathcal{O}'(U')
& =
R\Gamma(V, K) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}'(V')
\otimes_{\mathcal{O}'(V')}^\mathbf{L} \mathcal{O}'(U') \\
& =
R\Gamma(V, K) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}'(U') \\
& =
R\Gamma(V, K) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)
\otimes_{\mathcal{O}(U)}^\mathbf{L} \mathcal{O}'(U') \\
& =
R\Gamma(U, K) \otimes_{\mathcal{O}(U)}^\mathbf{L} \mathcal{O}'(U') \\
& =
R\Gamma(U', Lg^*K)
\end{align*}
as desired. Here we have used the observation above both for $U'$ and $V'$.
\end{proof}

\begin{lemma}
\label{lemma-cartesian-flat-quasi-coherent}
Let $\mathcal{C}$ be a category viewed as a site with the chaotic
topology. Let $\mathcal{O}$ be a sheaf of rings on $\mathcal{C}$.
Assume for all $U \to V$ in $\mathcal{C}$ the restriction map
$\mathcal{O}(V) \to \mathcal{O}(U)$ is a flat ring map.
Then $\mathit{QC}(\mathcal{O})$ agrees with the subcategory
$D_\QCoh(\mathcal{O}) \subset D(\mathcal{O})$ of complexes
whose cohomology sheaves are quasi-coherent.
\end{lemma}

\begin{proof}
Recall that $\QCoh(\mathcal{O}) \subset \textit{Mod}(\mathcal{O})$
is a weak Serre subcategory under our assumptions, see
Modules on Sites, Lemma \ref{sites-modules-lemma-chaotic-flat-quasi-coherent}.
Thus taking the full subcategory
$$
D_\QCoh(\mathcal{O}) = D_{\QCoh(\mathcal{O})}(\textit{Mod}(\mathcal{O}))
$$
of $D(\mathcal{O})$ makes sense, see Derived Categories, Section
\ref{derived-section-triangulated-sub}. (Strictly speaking we don't need
this in the proof of the lemma.)

\medskip\noindent
Let $M$ be an object of $\mathit{QC}(\mathcal{O})$. Since for every
morphism $U \to V$ in $\mathcal{C}$ the restriction map
$\mathcal{O}(V) \to \mathcal{O}(U)$ is flat, we see that
\begin{align*}
H^i(M)(U)
& =
H^i(R\Gamma(U, M)) \\
& =
H^i(R\Gamma(V, M) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)) \\
& =
H^i(R\Gamma(V, M)) \otimes_{\mathcal{O}(V)} \mathcal{O}(U) \\
& =
H^i(M)(V) \otimes_{\mathcal{O}(V)} \mathcal{O}(U)
\end{align*}
and hence $H^i(M)$ is quasi-coherent by
Modules on Sites, Lemma \ref{sites-modules-lemma-chaotic-quasi-coherent}.
The first and last equality above follow from the fact that
taking sections over an object of $\mathcal{C}$ is an exact functor
due to the fact that the topology on $\mathcal{C}$ is chaotic.

\medskip\noindent
Conversely, if $M$ is an object of $D_\QCoh(\mathcal{O})$, then due to
Modules on Sites, Lemma \ref{sites-modules-lemma-chaotic-quasi-coherent}
we see that the map $R\Gamma(V, M) \to R\Gamma(U, M)$ induces isomorphisms
$H^i(M)(U) \to H^i(M)(V) \otimes_{\mathcal{O}(V)} \mathcal{O}(U)$.
Whence $R\Gamma(V, K) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)
\to R\Gamma(U, K)$ is an isomorphism in $D(\mathcal{O}(U))$ by the flatness
of $\mathcal{O}(V) \to \mathcal{O}(U)$ and we
conclude that $M$ is in $\mathit{QC}(\mathcal{O})$.
\end{proof}

\begin{lemma}
\label{lemma-cartesion-plus-topology}
Let $\epsilon : (\mathcal{C}_\tau, \mathcal{O}_\tau) \to
(\mathcal{C}_{\tau'}, \mathcal{O}_{\tau'})$ be as in
Section \ref{section-compare}. Assume
\begin{enumerate}
\item $\tau'$ is the chaotic topology on the category $\mathcal{C}$,
\item for all $U \in \Ob(\mathcal{C})$ and all K-flat complexes of
$\mathcal{O}(U)$-modules $M^\bullet$ the map
$$
M^\bullet \longrightarrow
R\Gamma((\mathcal{C}/U)_\tau,
(M^\bullet \otimes_{\mathcal{O}(U)} \mathcal{O}_U)^\#)
$$
is a quasi-isomorphism (see proof for an explanation).
\end{enumerate}
Then $\epsilon^*$ and $R\epsilon_*$ define mutually quasi-inverse
equivalences between $\mathit{QC}(\mathcal{O})$ and
the full subcategory of $D(\mathcal{C}_\tau, \mathcal{O}_\tau)$
consisting of objects $K$ such that $R\epsilon_*K$ is in
$\mathit{QC}(\mathcal{O})$\footnote{This means that
$R\Gamma(V, K) \otimes_{\mathcal{O}(V)}^\mathbf{L} \mathcal{O}(U)
\to R\Gamma(U, K)$ is an isomorphism for all $U \to V$ in $\mathcal{C}$.}.
\end{lemma}

\begin{proof}
We will use the observations made in Section \ref{section-compare} without
further mention. Since $R\epsilon_*$
is fully faithful and $\epsilon^* \circ R\epsilon_* = \text{id}$,
to prove the lemma it suffices to show that for $M$ in
$\mathit{QC}(\mathcal{O})$ we have $R\epsilon_*(\epsilon^*M) = M$.
Condition (2) is exactly the condition needed to see this.
Namely, we choose a K-flat complex $\mathcal{M}^\bullet$
of $\mathcal{O}$-modules with flat terms representing $M$.
Then we see that $\epsilon^*M$ is represented by the $\tau$-sheafification
$(\mathcal{M}^\bullet)^\#$ of $\mathcal{M}^\bullet$.
Let $U \in \Ob(\mathcal{C})$. By Leray we get
$$
R\Gamma(U, R\epsilon_*(\epsilon^*M)) =
R\Gamma((\mathcal{C}/U)_\tau, (\mathcal{M}^\bullet)^\#|_{\mathcal{C}/U}) =
R\Gamma((\mathcal{C}/U)_\tau, (\mathcal{M}^\bullet|_{\mathcal{C}/U})^\#)
$$
The last equality since
sheafification commutes with restriction to $\mathcal{C}/U$.
As usual, denote $\mathcal{O}_U$ the restriction of $\mathcal{O}$ to
$\mathcal{C}/U$. Consider the map
$$
\mathcal{M}^\bullet(U) \otimes_{\mathcal{O}(U)} \mathcal{O}_U
\longrightarrow
\mathcal{M}^\bullet|_{\mathcal{C}/U}
$$
of complexes of $\mathcal{O}_U$-modules (in $\tau'$-topology).
By our choice of $\mathcal{M}^\bullet$ the complex $\mathcal{M}^\bullet(U)$
is a K-flat complex of $\mathcal{O}(U)$-modules; see
Lemma \ref{lemma-pullback-K-flat} and use that the inclusion
of $U$ into $\mathcal{C}$ defines a morphism of ringed topoi
$(\Sh(pt), \mathcal{O}(U)) \to (\Sh(\mathcal{C}_{\tau'}), \mathcal{O})$.
Since $M$ is in $\mathit{QC}(\mathcal{O})$ we conclude that
the displayed arrow is a quasi-isomorphism. Since sheafification
is exact, we see that the same remains true after sheafification.
Hence
$$
R\Gamma(U, R\epsilon_*(\epsilon^*M)) =
R\Gamma((\mathcal{C}/U)_\tau,
(M^\bullet \otimes_{\mathcal{O}(U)} \mathcal{O}_U)^\#)
$$
and assumption (2) tells us this is equal to
$R\Gamma(U, M) = \mathcal{M}^\bullet(U)$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-QC-hom-out-of-plus-topology}
Notation and assumptions as in Lemma \ref{lemma-cartesion-plus-topology}.
Suppose that $K$ is an object of
$\mathit{QC}(\mathcal{O})$ and $M$ arbitrary in $D(\mathcal{O}_\tau)$.
For every object $U$ of $\mathcal{C}$ we have
$$
\Hom_{D((\mathcal{O}_U)_\tau)}(\epsilon^*K|_U, M|_U) =
R\Hom_{\mathcal{O}(U)}(R\Gamma(U, K), R\Gamma(U, M))
$$
\end{lemma}

\begin{proof}
We have
$$
\Hom_{D((\mathcal{O}_U)_\tau)}(\epsilon^*K|_U, M|_U) =
\Hom_{D((\mathcal{O}_U)_{\tau'})}(K|_U, R\epsilon_*M|_U)
$$
by adjunction. Hence the result by Lemma \ref{lemma-QC-hom-out-of}
and the fact that
$$
R\Gamma(U, M) = R\Gamma(U, R\epsilon_*M)
$$
by Leray.
\end{proof}







\section{Strictly perfect complexes}
\label{section-strictly-perfect}

\noindent
This section is the analogue of
Cohomology, Section \ref{cohomology-section-strictly-perfect}.

\begin{definition}
\label{definition-strictly-perfect}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{E}^\bullet$ be a complex of $\mathcal{O}$-modules.
We say $\mathcal{E}^\bullet$ is {\it strictly perfect}
if $\mathcal{E}^i$ is zero for all but finitely many $i$ and
$\mathcal{E}^i$ is a direct summand of a finite free
$\mathcal{O}$-module for all $i$.
\end{definition}

\noindent
Let $U$ be an object of $\mathcal{C}$. We will often say
``Let $\mathcal{E}^\bullet$ be a strictly perfect complex of
$\mathcal{O}_U$-modules'' to mean $\mathcal{E}^\bullet$ is a strictly perfect
complex of modules on the ringed site $(\mathcal{C}/U, \mathcal{O}_U)$, see
Modules on Sites, Definition
\ref{sites-modules-definition-localize-ringed-site}.

\begin{lemma}
\label{lemma-cone}
The cone on a morphism of strictly perfect complexes is
strictly perfect.
\end{lemma}

\begin{proof}
This is immediate from the definitions.
\end{proof}

\begin{lemma}
\label{lemma-tensor}
The total complex associated to the tensor product of two
strictly perfect complexes is strictly perfect.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-strictly-perfect-pullback}
Let $(f, f^\sharp) : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. If $\mathcal{F}^\bullet$ is a strictly
perfect complex of $\mathcal{O}_\mathcal{D}$-modules, then
$f^*\mathcal{F}^\bullet$ is a strictly perfect complex of
$\mathcal{O}_\mathcal{C}$-modules.
\end{lemma}

\begin{proof}
We have seen in
Modules on Sites, Lemma \ref{sites-modules-lemma-global-pullback}
that the pullback of a finite free module is finite free. The functor
$f^*$ is additive functor hence preserves direct summands. The lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-local-lift-map}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an object of
$\mathcal{C}$. Given a solid diagram of $\mathcal{O}_U$-modules
$$
\xymatrix{
\mathcal{E} \ar@{..>}[dr] \ar[r] & \mathcal{F} \\
& \mathcal{G} \ar[u]_p
}
$$
with $\mathcal{E}$ a direct summand of a finite free
$\mathcal{O}_U$-module and $p$ surjective, then there exists a
covering $\{U_i \to U\}$ such that a dotted arrow
making the diagram commute exists over each $U_i$.
\end{lemma}

\begin{proof}
We may assume $\mathcal{E} = \mathcal{O}_U^{\oplus n}$ for some $n$.
In this case finding the dotted arrow is equivalent to lifting the
images of the basis elements in $\Gamma(U, \mathcal{F})$. This is
locally possible by the characterization of surjective maps of
sheaves (Sites, Section \ref{sites-section-sheaves-injective}).
\end{proof}

\begin{lemma}
\label{lemma-local-homotopy}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an object
of $\mathcal{C}$.
\begin{enumerate}
\item Let $\alpha : \mathcal{E}^\bullet \to \mathcal{F}^\bullet$
be a morphism of complexes of $\mathcal{O}_U$-modules
with $\mathcal{E}^\bullet$ strictly perfect and $\mathcal{F}^\bullet$
acyclic. Then there exists a covering $\{U_i \to U\}$ such that each
$\alpha|_{U_i}$ is homotopic to zero.
\item Let $\alpha : \mathcal{E}^\bullet \to \mathcal{F}^\bullet$
be a morphism of complexes of $\mathcal{O}_U$-modules
with $\mathcal{E}^\bullet$ strictly perfect, $\mathcal{E}^i = 0$
for $i < a$, and $H^i(\mathcal{F}^\bullet) = 0$ for $i \geq a$.
Then there exists a covering $\{U_i \to U\}$ such that each
$\alpha|_{U_i}$ is homotopic to zero.
\end{enumerate}
\end{lemma}

\begin{proof}
The first statement follows from the second, hence we only prove (2).
We will prove this by induction on the length of the complex
$\mathcal{E}^\bullet$. If $\mathcal{E}^\bullet \cong \mathcal{E}[-n]$
for some direct summand $\mathcal{E}$ of a finite free
$\mathcal{O}$-module and integer $n \geq a$, then the result follows from
Lemma \ref{lemma-local-lift-map} and the fact that
$\mathcal{F}^{n - 1} \to \Ker(\mathcal{F}^n \to \mathcal{F}^{n + 1})$
is surjective by the assumed vanishing of $H^n(\mathcal{F}^\bullet)$.
If $\mathcal{E}^i$ is zero except for $i \in [a, b]$, then we have a
split exact sequence of complexes
$$
0 \to \mathcal{E}^b[-b] \to \mathcal{E}^\bullet \to
\sigma_{\leq b - 1}\mathcal{E}^\bullet \to 0
$$
which determines a distinguished triangle in
$K(\mathcal{O}_U)$. Hence an exact sequence
$$
\Hom_{K(\mathcal{O}_U)}(
\sigma_{\leq b - 1}\mathcal{E}^\bullet, \mathcal{F}^\bullet)
\to
\Hom_{K(\mathcal{O}_U)}(\mathcal{E}^\bullet, \mathcal{F}^\bullet)
\to
\Hom_{K(\mathcal{O}_U)}(\mathcal{E}^b[-b], \mathcal{F}^\bullet)
$$
by the axioms of triangulated categories. The composition
$\mathcal{E}^b[-b] \to \mathcal{F}^\bullet$ is homotopic to zero
on the members of a covering of $U$ by the above,
whence we may assume our map comes from an element in the
left hand side of the displayed exact sequence above. This element
is zero on the members of a covering of $U$ by induction hypothesis.
\end{proof}

\begin{lemma}
\label{lemma-lift-through-quasi-isomorphism}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an object of
$\mathcal{C}$. Given a solid diagram of complexes of $\mathcal{O}_U$-modules
$$
\xymatrix{
\mathcal{E}^\bullet \ar@{..>}[dr] \ar[r]_\alpha & \mathcal{F}^\bullet \\
& \mathcal{G}^\bullet \ar[u]_f
}
$$
with $\mathcal{E}^\bullet$ strictly perfect, $\mathcal{E}^j = 0$ for
$j < a$ and $H^j(f)$ an isomorphism for $j > a$ and surjective for
$j = a$, then there exists a covering $\{U_i \to U\}$ and for each $i$
a dotted arrow over $U_i$ making the diagram commute up to homotopy.
\end{lemma}

\begin{proof}
Our assumptions on $f$ imply the cone $C(f)^\bullet$ has vanishing
cohomology sheaves in degrees $\geq a$.
Hence Lemma \ref{lemma-local-homotopy} guarantees there is a
covering $\{U_i \to U\}$ such that the composition
$\mathcal{E}^\bullet \to \mathcal{F}^\bullet \to C(f)^\bullet$
is homotopic to zero over $U_i$. Since
$$
\mathcal{G}^\bullet \to \mathcal{F}^\bullet \to C(f)^\bullet \to
\mathcal{G}^\bullet[1]
$$
restricts to a distinguished triangle in $K(\mathcal{O}_{U_i})$
we see that we can lift $\alpha|_{U_i}$ up to homotopy to a map
$\alpha_i : \mathcal{E}^\bullet|_{U_i} \to \mathcal{G}^\bullet|_{U_i}$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-local-actual}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an object
of $\mathcal{C}$. Let $\mathcal{E}^\bullet$, $\mathcal{F}^\bullet$ be
complexes of $\mathcal{O}_U$-modules with $\mathcal{E}^\bullet$ strictly
perfect.
\begin{enumerate}
\item For any element
$\alpha \in \Hom_{D(\mathcal{O}_U)}(\mathcal{E}^\bullet, \mathcal{F}^\bullet)$
there exists a covering $\{U_i \to U\}$ such that
$\alpha|_{U_i}$ is given by a morphism of complexes
$\alpha_i : \mathcal{E}^\bullet|_{U_i} \to \mathcal{F}^\bullet|_{U_i}$.
\item Given a morphism of complexes
$\alpha : \mathcal{E}^\bullet \to \mathcal{F}^\bullet$
whose image in the group
$\Hom_{D(\mathcal{O}_U)}(\mathcal{E}^\bullet, \mathcal{F}^\bullet)$
is zero, there exists a covering $\{U_i \to U\}$ such that
$\alpha|_{U_i}$ is homotopic to zero.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1).
By the construction of the derived category we can find a quasi-isomorphism
$f : \mathcal{F}^\bullet \to \mathcal{G}^\bullet$ and a map of complexes
$\beta : \mathcal{E}^\bullet \to \mathcal{G}^\bullet$ such that
$\alpha = f^{-1}\beta$. Thus the result follows from
Lemma \ref{lemma-lift-through-quasi-isomorphism}.
We omit the proof of (2).
\end{proof}

\begin{lemma}
\label{lemma-Rhom-strictly-perfect}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{E}^\bullet$, $\mathcal{F}^\bullet$ be complexes
of $\mathcal{O}$-modules with $\mathcal{E}^\bullet$ strictly perfect.
Then the internal hom $R\SheafHom(\mathcal{E}^\bullet, \mathcal{F}^\bullet)$
is represented by the complex $\mathcal{H}^\bullet$ with terms
$$
\mathcal{H}^n =
\bigoplus\nolimits_{n = p + q}
\SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{F}^p)
$$
and differential as described in Section \ref{section-internal-hom}.
\end{lemma}

\begin{proof}
Choose a quasi-isomorphism $\mathcal{F}^\bullet \to \mathcal{I}^\bullet$
into a K-injective complex. Let $(\mathcal{H}')^\bullet$ be the
complex with terms
$$
(\mathcal{H}')^n =
\prod\nolimits_{n = p + q}
\SheafHom_\mathcal{O}(\mathcal{L}^{-q}, \mathcal{I}^p)
$$
which represents $R\SheafHom(\mathcal{E}^\bullet, \mathcal{F}^\bullet)$
by the construction in Section \ref{section-internal-hom}. It suffices
to show that the map
$$
\mathcal{H}^\bullet \longrightarrow (\mathcal{H}')^\bullet
$$
is a quasi-isomorphism. Given an object $U$ of $\mathcal{C}$ we have
by inspection
$$
H^0(\mathcal{H}^\bullet(U)) =
\Hom_{K(\mathcal{O}_U)}(\mathcal{E}^\bullet|_U, \mathcal{K}^\bullet|_U)
\to
H^0((\mathcal{H}')^\bullet(U)) =
\Hom_{D(\mathcal{O}_U)}(\mathcal{E}^\bullet|_U, \mathcal{K}^\bullet|_U)
$$
By Lemma \ref{lemma-local-actual} the sheafification of
$U \mapsto H^0(\mathcal{H}^\bullet(U))$
is equal to the sheafification of
$U \mapsto H^0((\mathcal{H}')^\bullet(U))$. A similar argument can be
given for the other cohomology sheaves. Thus $\mathcal{H}^\bullet$
is quasi-isomorphic to $(\mathcal{H}')^\bullet$ which proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-Rhom-complex-of-direct-summands-finite-free}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{E}^\bullet$, $\mathcal{F}^\bullet$ be complexes
of $\mathcal{O}$-modules with
\begin{enumerate}
\item $\mathcal{F}^n = 0$ for $n \ll 0$,
\item $\mathcal{E}^n = 0$ for $n \gg 0$, and
\item $\mathcal{E}^n$ isomorphic to a direct summand of a finite
free $\mathcal{O}$-module.
\end{enumerate}
Then the internal hom $R\SheafHom(\mathcal{E}^\bullet, \mathcal{F}^\bullet)$
is represented by the complex $\mathcal{H}^\bullet$ with terms
$$
\mathcal{H}^n =
\bigoplus\nolimits_{n = p + q}
\SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{F}^p)
$$
and differential as described in Section \ref{section-internal-hom}.
\end{lemma}

\begin{proof}
Choose a quasi-isomorphism $\mathcal{F}^\bullet \to \mathcal{I}^\bullet$
where $\mathcal{I}^\bullet$ is a bounded below complex of injectives.
Note that $\mathcal{I}^\bullet$ is K-injective
(Derived Categories, Lemma
\ref{derived-lemma-bounded-below-injectives-K-injective}).
Hence the construction in Section \ref{section-internal-hom}
shows that
$R\SheafHom(\mathcal{E}^\bullet, \mathcal{F}^\bullet)$ is 
represented by the complex $(\mathcal{H}')^\bullet$ with terms
$$
(\mathcal{H}')^n =
\prod\nolimits_{n = p + q}
\SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{I}^p) =
\bigoplus\nolimits_{n = p + q}
\SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{I}^p)
$$
(equality because there are only finitely many nonzero terms).
Note that $\mathcal{H}^\bullet$ is the total complex associated to
the double complex with terms
$\SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{F}^p)$
and similarly for $(\mathcal{H}')^\bullet$.
The natural map $(\mathcal{H}')^\bullet \to \mathcal{H}^\bullet$
comes from a map of double complexes.
Thus to show this map is a quasi-isomorphism, we may use the spectral
sequence of a double complex
(Homology, Lemma \ref{homology-lemma-first-quadrant-ss})
$$
{}'E_1^{p, q} =
H^p(\SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{F}^\bullet))
$$
converging to $H^{p + q}(\mathcal{H}^\bullet)$ and similarly for
$(\mathcal{H}')^\bullet$. To finish the proof of the lemma it
suffices to show that $\mathcal{F}^\bullet \to \mathcal{I}^\bullet$
induces an isomorphism
$$
H^p(\SheafHom_\mathcal{O}(\mathcal{E}, \mathcal{F}^\bullet))
\longrightarrow
H^p(\SheafHom_\mathcal{O}(\mathcal{E}, \mathcal{I}^\bullet))
$$
on cohomology sheaves whenever $\mathcal{E}$ is a direct summand of a
finite free $\mathcal{O}$-module. Since this is clear when $\mathcal{E}$
is finite free the result follows.
\end{proof}









\section{Pseudo-coherent modules}
\label{section-pseudo-coherent}

\noindent
In this section we discuss pseudo-coherent complexes.

\begin{definition}
\label{definition-pseudo-coherent}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{E}^\bullet$
be a complex of $\mathcal{O}$-modules. Let $m \in \mathbf{Z}$.
\begin{enumerate}
\item We say $\mathcal{E}^\bullet$ is {\it $m$-pseudo-coherent}
if for every object $U$ of $\mathcal{C}$ there exists a covering
$\{U_i \to U\}$ and for each $i$ a morphism of complexes
$\alpha_i : \mathcal{E}_i^\bullet \to \mathcal{E}^\bullet|_{U_i}$
where $\mathcal{E}_i$ is a strictly perfect complex of
$\mathcal{O}_{U_i}$-modules and $H^j(\alpha_i)$ is an isomorphism
for $j > m$ and $H^m(\alpha_i)$ is surjective.
\item We say $\mathcal{E}^\bullet$ is {\it pseudo-coherent}
if it is $m$-pseudo-coherent for all $m$.
\item We say an object $E$ of $D(\mathcal{O})$ is
{\it $m$-pseudo-coherent} (resp.\ {\it pseudo-coherent})
if and only if it can be represented by a $m$-pseudo-coherent
(resp.\ pseudo-coherent) complex of $\mathcal{O}$-modules.
\end{enumerate}
\end{definition}

\noindent
If $\mathcal{C}$ has a final object $X$ which is quasi-compact
(for example if every covering of $X$ can be refined by a finite covering),
then an $m$-pseudo-coherent object of $D(\mathcal{O})$ is in
$D^-(\mathcal{O})$. But this need not be the case in general.

\begin{lemma}
\label{lemma-pseudo-coherent-independent-representative}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $E$ be an object of $D(\mathcal{O})$.
\begin{enumerate}
\item If $\mathcal{C}$ has a final object $X$ and if there exist a covering
$\{U_i \to X\}$, strictly perfect complexes $\mathcal{E}_i^\bullet$ of
$\mathcal{O}_{U_i}$-modules, and
maps $\alpha_i : \mathcal{E}_i^\bullet \to E|_{U_i}$ in
$D(\mathcal{O}_{U_i})$ with $H^j(\alpha_i)$ an isomorphism for $j > m$
and $H^m(\alpha_i)$ surjective, then $E$ is $m$-pseudo-coherent.
\item If $E$ is $m$-pseudo-coherent, then any complex of $\mathcal{O}$-modules
representing $E$ is $m$-pseudo-coherent.
\item If for every object $U$ of $\mathcal{C}$ there exists a covering
$\{U_i \to U\}$ such that $E|_{U_i}$ is $m$-pseudo-coherent, then
$E$ is $m$-pseudo-coherent.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\mathcal{F}^\bullet$ be any complex representing $E$
and let $X$, $\{U_i \to X\}$, and $\alpha_i : \mathcal{E}_i \to E|_{U_i}$
be as in (1). We will show that $\mathcal{F}^\bullet$ is $m$-pseudo-coherent
as a complex, which will prove (1) and (2) in case $\mathcal{C}$ has a
final object. By Lemma \ref{lemma-local-actual}
we can after refining the covering $\{U_i \to X\}$
represent the maps $\alpha_i$ by maps of complexes
$\alpha_i : \mathcal{E}_i^\bullet \to \mathcal{F}^\bullet|_{U_i}$.
By assumption
$H^j(\alpha_i)$ are isomorphisms for $j > m$, and $H^m(\alpha_i)$
is surjective whence $\mathcal{F}^\bullet$ is
$m$-pseudo-coherent.

\medskip\noindent
Proof of (2). By the above we see that $\mathcal{F}^\bullet|_U$ is
$m$-pseudo-coherent as a complex of $\mathcal{O}_U$-modules for all
objects $U$ of $\mathcal{C}$. It is a formal consequence of the definitions
that $\mathcal{F}^\bullet$ is $m$-pseudo-coherent.

\medskip\noindent
Proof of (3). Follows from the definitions and
Sites, Definition \ref{sites-definition-site} part (2).
\end{proof}

\begin{lemma}
\label{lemma-pseudo-coherent-pullback}
Let $(f, f^\sharp) : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$
be a morphism of ringed sites. Let $E$ be an object of
$D(\mathcal{O}_\mathcal{C})$. If $E$ is $m$-pseudo-coherent,
then $Lf^*E$ is $m$-pseudo-coherent.
\end{lemma}

\begin{proof}
Say $f$ is given by the functor $u : \mathcal{D} \to \mathcal{C}$.
Let $U$ be an object of $\mathcal{C}$. By
Sites, Lemma \ref{sites-lemma-morphism-of-sites-covering}
we can find a covering $\{U_i \to U\}$ and for each $i$ a morphism
$U_i \to u(V_i)$ for some object $V_i$ of $\mathcal{D}$.
By Lemma \ref{lemma-pseudo-coherent-independent-representative}
it suffices to show that $Lf^*E|_{U_i}$ is $m$-pseudo-coherent.
To do this it is enough to show that $Lf^*E|_{u(V_i)}$ is
$m$-pseudo-coherent, since $Lf^*E|_{U_i}$ is the restriction
of $Lf^*E|_{u(V_i)}$ to $\mathcal{C}/U_i$ (via
Modules on Sites, Lemma
\ref{sites-modules-lemma-relocalize}).
By the commutative diagram of
Modules on Sites, Lemma
\ref{sites-modules-lemma-localize-morphism-ringed-sites}
it suffices to prove the lemma for the morphism of ringed
sites $(\mathcal{C}/u(V_i), \mathcal{O}_{u(V_i)}) \to
(\mathcal{D}/V_i, \mathcal{O}_{V_i})$.
Thus we may assume $\mathcal{D}$ has a final object $Y$ such that
$X = u(Y)$ is a final object of $\mathcal{C}$.

\medskip\noindent
Let $\{V_i \to Y\}$ be a covering such that for each $i$ there exists
a strictly perfect complex $\mathcal{F}_i^\bullet$ of
$\mathcal{O}_{V_i}$-modules and a morphism
$\alpha_i : \mathcal{F}_i^\bullet \to E|_{V_i}$ of $D(\mathcal{O}_{V_i})$
such that $H^j(\alpha_i)$ is an isomorphism
for $j > m$ and $H^m(\alpha_i)$ is surjective.
Arguing as above it suffices to prove the result for
$(\mathcal{C}/u(V_i), \mathcal{O}_{u(V_i)}) \to
(\mathcal{D}/V_i, \mathcal{O}_{V_i})$. Hence we may assume that
there exists a strictly perfect complex $\mathcal{F}^\bullet$ of
$\mathcal{O}_\mathcal{D}$-modules and a morphism
$\alpha : \mathcal{F}^\bullet \to E$ of $D(\mathcal{O}_\mathcal{D})$
such that $H^j(\alpha)$ is an isomorphism
for $j > m$ and $H^m(\alpha)$ is surjective. In this case, choose
a distinguished triangle
$$
\mathcal{F}^\bullet \to E \to C \to \mathcal{F}^\bullet[1]
$$
The assumption on $\alpha$ means exactly that the cohomology sheaves
$H^j(C)$ are zero for all $j \geq m$. Applying $Lf^*$ we obtain
the distinguished triangle
$$
Lf^*\mathcal{F}^\bullet \to Lf^*E \to Lf^*C \to Lf^*\mathcal{F}^\bullet[1]
$$
By the construction of $Lf^*$ as a left derived functor we see that
$H^j(Lf^*C) = 0$ for $j \geq m$ (by the dual of Derived Categories, Lemma
\ref{derived-lemma-negative-vanishing}). Hence $H^j(Lf^*\alpha)$ is an
isomorphism for $j > m$ and $H^m(Lf^*\alpha)$ is surjective.
On the other hand, since
$\mathcal{F}^\bullet$ is a bounded above complex of flat
$\mathcal{O}_\mathcal{D}$-modules we see that
$Lf^*\mathcal{F}^\bullet = f^*\mathcal{F}^\bullet$.
Applying Lemma \ref{lemma-strictly-perfect-pullback} we conclude.
\end{proof}

\begin{lemma}
\label{lemma-cone-pseudo-coherent}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site and $m \in \mathbf{Z}$.
Let $(K, L, M, f, g, h)$ be a distinguished triangle in $D(\mathcal{O})$.
\begin{enumerate}
\item If $K$ is $(m + 1)$-pseudo-coherent and $L$ is $m$-pseudo-coherent
then $M$ is $m$-pseudo-coherent.
\item If $K$ and $M$ are $m$-pseudo-coherent, then $L$ is $m$-pseudo-coherent.
\item If $L$ is $(m + 1)$-pseudo-coherent and $M$
is $m$-pseudo-coherent, then $K$ is $(m + 1)$-pseudo-coherent.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Let $U$ be an object of $\mathcal{C}$. Choose a covering
$\{U_i \to U\}$ and maps $\alpha_i : \mathcal{K}_i^\bullet \to K|_{U_i}$
in $D(\mathcal{O}_{U_i})$ with $\mathcal{K}_i^\bullet$ strictly perfect and
$H^j(\alpha_i)$ isomorphisms for $j > m + 1$ and surjective for $j = m + 1$.
We may replace $\mathcal{K}_i^\bullet$ by
$\sigma_{\geq m + 1}\mathcal{K}_i^\bullet$
and hence we may assume that $\mathcal{K}_i^j = 0$
for $j < m + 1$. After refining the covering we may choose
maps $\beta_i : \mathcal{L}_i^\bullet \to L|_{U_i}$ in $D(\mathcal{O}_{U_i})$
with $\mathcal{L}_i^\bullet$ strictly perfect such that
$H^j(\beta)$ is an isomorphism for $j > m$ and
surjective for $j = m$. By
Lemma \ref{lemma-lift-through-quasi-isomorphism}
we can, after refining the covering, find maps of complexes
$\gamma_i : \mathcal{K}^\bullet \to \mathcal{L}^\bullet$
such that the diagrams
$$
\xymatrix{
K|_{U_i} \ar[r] & L|_{U_i} \\
\mathcal{K}_i^\bullet \ar[u]^{\alpha_i} \ar[r]^{\gamma_i} &
\mathcal{L}_i^\bullet \ar[u]_{\beta_i}
}
$$
are commutative in $D(\mathcal{O}_{U_i})$ (this requires representing the
maps $\alpha_i$, $\beta_i$ and $K|_{U_i} \to L|_{U_i}$
by actual maps of complexes; some details omitted).
The cone $C(\gamma_i)^\bullet$ is strictly perfect (Lemma \ref{lemma-cone}).
The commutativity of the diagram implies that there exists a morphism
of distinguished triangles
$$
(\mathcal{K}_i^\bullet, \mathcal{L}_i^\bullet, C(\gamma_i)^\bullet)
\longrightarrow
(K|_{U_i}, L|_{U_i}, M|_{U_i}).
$$
It follows from the induced map on long exact cohomology sequences and
Homology, Lemmas \ref{homology-lemma-four-lemma} and
\ref{homology-lemma-five-lemma}
that $C(\gamma_i)^\bullet \to M|_{U_i}$ induces an isomorphism
on cohomology in degrees $> m$ and a surjection in degree $m$.
Hence $M$ is $m$-pseudo-coherent by
Lemma \ref{lemma-pseudo-coherent-independent-representative}.

\medskip\noindent
Assertions (2) and (3) follow from (1) by rotating the distinguished
triangle.
\end{proof}

\begin{lemma}
\label{lemma-tensor-pseudo-coherent}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K, L$ be objects
of $D(\mathcal{O})$.
\begin{enumerate}
\item If $K$ is $n$-pseudo-coherent and $H^i(K) = 0$ for $i > a$
and $L$ is $m$-pseudo-coherent and $H^j(L) = 0$ for $j > b$, then
$K \otimes_\mathcal{O}^\mathbf{L} L$ is $t$-pseudo-coherent
with $t = \max(m + a, n + b)$.
\item If $K$ and $L$ are pseudo-coherent, then
$K \otimes_\mathcal{O}^\mathbf{L} L$ is pseudo-coherent.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Let $U$ be an object of $\mathcal{C}$.
By replacing $U$ by the members of a covering
and replacing $\mathcal{C}$ by the localization $\mathcal{C}/U$
we may assume there exist strictly perfect complexes $\mathcal{K}^\bullet$
and $\mathcal{L}^\bullet$ and maps
$\alpha : \mathcal{K}^\bullet \to K$ and
$\beta : \mathcal{L}^\bullet \to L$ with $H^i(\alpha)$ and isomorphism
for $i > n$ and surjective for $i = n$ and with
$H^i(\beta)$ and isomorphism for $i > m$ and surjective for $i = m$.
Then the map
$$
\alpha \otimes^\mathbf{L} \beta :
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{L}^\bullet)
\to K \otimes_\mathcal{O}^\mathbf{L} L
$$
induces isomorphisms on cohomology sheaves in degree $i$ for
$i > t$ and a surjection for $i = t$. This follows from the
spectral sequence of tors (details omitted).

\medskip\noindent
Proof of (2). Let $U$ be an object of $\mathcal{C}$.
We may first replace $U$ by the members of a covering
and $\mathcal{C}$ by the localization $\mathcal{C}/U$
to reduce to the case that $K$ and $L$ are bounded above.
Then the statement follows immediately from case (1).
\end{proof}

\begin{lemma}
\label{lemma-summands-pseudo-coherent}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $m \in \mathbf{Z}$.
If $K \oplus L$ is $m$-pseudo-coherent (resp.\ pseudo-coherent)
in $D(\mathcal{O})$ so are $K$ and $L$.
\end{lemma}

\begin{proof}
Assume that $K \oplus L$ is $m$-pseudo-coherent. Let $U$ be an object of
$\mathcal{C}$. After replacing $U$ by the members of a covering we may
assume $K \oplus L \in D^-(\mathcal{O}_U)$, hence $L \in D^-(\mathcal{O}_U)$.
Note that there is a distinguished triangle
$$
(K \oplus L, K \oplus L, L \oplus L[1]) =
(K, K, 0) \oplus (L, L, L \oplus L[1])
$$
see
Derived Categories, Lemma \ref{derived-lemma-direct-sum-triangles}.
By
Lemma \ref{lemma-cone-pseudo-coherent}
we see that $L \oplus L[1]$ is $m$-pseudo-coherent.
Hence also $L[1] \oplus L[2]$ is $m$-pseudo-coherent.
By induction $L[n] \oplus L[n + 1]$ is $m$-pseudo-coherent.
Since $L$ is bounded above we see that $L[n]$ is $m$-pseudo-coherent
for large $n$. Hence working backwards, using the distinguished triangles
$$
(L[n], L[n] \oplus L[n - 1], L[n - 1])
$$
we conclude that $L[n - 1], L[n - 2], \ldots, L$ are $m$-pseudo-coherent
as desired.
\end{proof}

\begin{lemma}
\label{lemma-finite-cohomology}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K$ be an object of
$D(\mathcal{O})$. Let $m \in \mathbf{Z}$.
\begin{enumerate}
\item If $K$ is $m$-pseudo-coherent and $H^i(K) = 0$
for $i > m$, then $H^m(K)$ is a finite type $\mathcal{O}$-module.
\item If $K$ is $m$-pseudo-coherent and $H^i(K) = 0$
for $i > m + 1$, then $H^{m + 1}(K)$ is a finitely presented
$\mathcal{O}$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Let $U$ be an object of $\mathcal{C}$. We have to show that
$H^m(K)$ is can be generated by finitely many sections over the members of
a covering of $U$ (see
Modules on Sites, Definition \ref{sites-modules-definition-site-local}).
Thus during the proof we may (finitely often) choose a covering
$\{U_i \to U\}$ and replace $\mathcal{C}$ by $\mathcal{C}/U_i$ and
$U$ by $U_i$. In particular, by our definitions we may assume there exists
a strictly perfect complex $\mathcal{E}^\bullet$ and a map
$\alpha : \mathcal{E}^\bullet \to K$ which induces
an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$.
It suffices to prove the result for $\mathcal{E}^\bullet$.
Let $n$ be the largest integer such that $\mathcal{E}^n \not = 0$.
If $n = m$, then $H^m(\mathcal{E}^\bullet)$ is a quotient of
$\mathcal{E}^n$ and the result is clear.
If $n > m$, then $\mathcal{E}^{n - 1} \to \mathcal{E}^n$ is surjective as
$H^n(E^\bullet) = 0$. By Lemma \ref{lemma-local-lift-map}
we can (after replacing $U$ by the members of a covering)
find a section of this surjection and write
$\mathcal{E}^{n - 1} = \mathcal{E}' \oplus \mathcal{E}^n$.
Hence it suffices to prove the result for the complex
$(\mathcal{E}')^\bullet$ which is the same as $\mathcal{E}^\bullet$
except has $\mathcal{E}'$ in degree $n - 1$ and $0$ in degree $n$.
We win by induction on $n$.

\medskip\noindent
Proof of (2). Pick an object $U$ of $\mathcal{C}$.
As in the proof of (1) we may work locally on $U$.
Hence we may assume there exists a strictly perfect complex
$\mathcal{E}^\bullet$ and a map
$\alpha : \mathcal{E}^\bullet \to K$ which induces
an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$.
As in the proof of (1) we can reduce to the case that $\mathcal{E}^i = 0$
for $i > m + 1$. Then we see that
$H^{m + 1}(K) \cong H^{m + 1}(\mathcal{E}^\bullet) =
\Coker(\mathcal{E}^m \to \mathcal{E}^{m + 1})$
which is of finite presentation.
\end{proof}








\section{Tor dimension}
\label{section-tor}

\noindent
In this section we take a closer look at resolutions by flat modules.

\begin{definition}
\label{definition-tor-amplitude}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $E$ be an object of $D(\mathcal{O})$.
Let $a, b \in \mathbf{Z}$ with $a \leq b$.
\begin{enumerate}
\item We say $E$ has {\it tor-amplitude in $[a, b]$}
if $H^i(E \otimes_\mathcal{O}^\mathbf{L} \mathcal{F}) = 0$
for all $\mathcal{O}$-modules $\mathcal{F}$ and all $i \not \in [a, b]$.
\item We say $E$ has {\it finite tor dimension}
if it has tor-amplitude in $[a, b]$ for some $a, b$.
\item We say $E$ {\it locally has finite tor dimension} if for any
object $U$ of $\mathcal{C}$ there exists a covering $\{U_i \to U\}$
such that $E|_{U_i}$ has finite tor dimension for all $i$.
\end{enumerate}
An $\mathcal{O}$-module $\mathcal{F}$ has {\it tor dimension $\leq d$}
if $\mathcal{F}[0]$ viewed as an object of $D(\mathcal{O})$ has
tor-amplitude in $[-d, 0]$.
\end{definition}

\noindent
Note that if $E$ as in the definition
has finite tor dimension, then $E$ is an object of
$D^b(\mathcal{O})$ as can be seen by taking $\mathcal{F} = \mathcal{O}$
in the definition above.

\begin{lemma}
\label{lemma-last-one-flat}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{E}^\bullet$ be a bounded above complex of flat
$\mathcal{O}$-modules with tor-amplitude in $[a, b]$.
Then $\Coker(d_{\mathcal{E}^\bullet}^{a - 1})$ is a flat
$\mathcal{O}$-module.
\end{lemma}

\begin{proof}
As $\mathcal{E}^\bullet$ is a bounded above complex of flat modules we see that
$\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F} =
\mathcal{E}^\bullet \otimes_\mathcal{O}^{\mathbf{L}} \mathcal{F}$
for any $\mathcal{O}$-module $\mathcal{F}$.
Hence for every $\mathcal{O}$-module $\mathcal{F}$ the sequence
$$
\mathcal{E}^{a - 2} \otimes_\mathcal{O} \mathcal{F} \to
\mathcal{E}^{a - 1} \otimes_\mathcal{O} \mathcal{F} \to
\mathcal{E}^a \otimes_\mathcal{O} \mathcal{F}
$$
is exact in the middle. Since
$\mathcal{E}^{a - 2} \to \mathcal{E}^{a - 1} \to \mathcal{E}^a \to
\Coker(d^{a - 1}) \to 0$
is a flat resolution this implies that
$\text{Tor}_1^\mathcal{O}(\Coker(d^{a - 1}), \mathcal{F}) = 0$
for all $\mathcal{O}$-modules $\mathcal{F}$. This means that
$\Coker(d^{a - 1})$ is flat, see Lemma \ref{lemma-flat-tor-zero}.
\end{proof}

\begin{lemma}
\label{lemma-tor-amplitude}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $E$ be an object of
$D(\mathcal{O})$. Let $a, b \in \mathbf{Z}$ with $a \leq b$. The following
are equivalent
\begin{enumerate}
\item $E$ has tor-amplitude in $[a, b]$.
\item $E$ is represented by a complex
$\mathcal{E}^\bullet$ of flat $\mathcal{O}$-modules with
$\mathcal{E}^i = 0$ for $i \not \in [a, b]$.
\end{enumerate}
\end{lemma}

\begin{proof}
If (2) holds, then we may compute
$E \otimes_\mathcal{O}^\mathbf{L} \mathcal{F} =
\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F}$
and it is clear that (1) holds.

\medskip\noindent
Assume that (1) holds. We may represent $E$ by a bounded above complex
of flat $\mathcal{O}$-modules $\mathcal{K}^\bullet$, see
Section \ref{section-flat}.
Let $n$ be the largest integer such that $\mathcal{K}^n \not = 0$.
If $n > b$, then $\mathcal{K}^{n - 1} \to \mathcal{K}^n$ is surjective as
$H^n(\mathcal{K}^\bullet) = 0$. As $\mathcal{K}^n$ is flat we see that
$\Ker(\mathcal{K}^{n - 1} \to \mathcal{K}^n)$ is flat
(Modules on Sites, Lemma \ref{sites-modules-lemma-flat-ses}).
Hence we may replace $\mathcal{K}^\bullet$ by
$\tau_{\leq n - 1}\mathcal{K}^\bullet$. Thus, by induction on $n$, we
reduce to the case that $K^\bullet$ is a complex of flat
$\mathcal{O}$-modules with $\mathcal{K}^i = 0$ for $i > b$.

\medskip\noindent
Set $\mathcal{E}^\bullet = \tau_{\geq a}\mathcal{K}^\bullet$.
Everything is clear except that $\mathcal{E}^a$ is flat
which follows immediately from Lemma \ref{lemma-last-one-flat}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-bounded-below-tor-amplitude}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $E$ be an object of
$D(\mathcal{O})$. Let $a \in \mathbf{Z}$. The following
are equivalent
\begin{enumerate}
\item $E$ has tor-amplitude in $[a, \infty]$.
\item $E$ can be represented by a K-flat complex $\mathcal{E}^\bullet$
of flat $\mathcal{O}$-modules with $\mathcal{E}^i = 0$ for
$i \not \in [a, \infty]$.
\end{enumerate}
Moreover, we can choose $\mathcal{E}^\bullet$ such that any pullback
by a morphism of ringed sites is a K-flat complex with flat terms.
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) is immediate. Assume (1) holds.
First we choose a K-flat complex $\mathcal{K}^\bullet$
with flat terms representing $E$, see Lemma \ref{lemma-K-flat-resolution}.
For any $\mathcal{O}$-module $\mathcal{M}$ the cohomology of
$$
\mathcal{K}^{n - 1} \otimes_\mathcal{O} \mathcal{M} \to
\mathcal{K}^n \otimes_\mathcal{O} \mathcal{M} \to
\mathcal{K}^{n + 1} \otimes_\mathcal{O} \mathcal{M}
$$
computes $H^n(E \otimes_\mathcal{O}^\mathbf{L} \mathcal{M})$.
This is always zero for $n < a$. Hence if we apply
Lemma \ref{lemma-last-one-flat} to the complex
$\ldots \to \mathcal{K}^{a - 1} \to \mathcal{K}^a \to \mathcal{K}^{a + 1}$
we conclude that $\mathcal{N} = \Coker(\mathcal{K}^{a - 1} \to \mathcal{K}^a)$
is a flat $\mathcal{O}$-module. We set
$$
\mathcal{E}^\bullet = \tau_{\geq a}\mathcal{K}^\bullet =
(\ldots \to 0 \to \mathcal{N} \to \mathcal{K}^{a + 1} \to \ldots )
$$
The kernel $\mathcal{L}^\bullet$ of
$\mathcal{K}^\bullet \to \mathcal{E}^\bullet$ is the complex
$$
\mathcal{L}^\bullet = (\ldots \to \mathcal{K}^{a - 1} \to
\mathcal{I} \to 0 \to \ldots)
$$
where $\mathcal{I} \subset \mathcal{K}^a$ is the image of
$\mathcal{K}^{a - 1} \to \mathcal{K}^a$.
Since we have the short exact sequence
$0 \to \mathcal{I} \to \mathcal{K}^a \to \mathcal{N} \to 0$
we see that $\mathcal{I}$ is a flat $\mathcal{O}$-module.
Thus $\mathcal{L}^\bullet$ is a bounded
above complex of flat modules, hence K-flat by
Lemma \ref{lemma-bounded-flat-K-flat}.
It follows that $\mathcal{E}^\bullet$ is K-flat by
Lemma \ref{lemma-K-flat-two-out-of-three-ses}.

\medskip\noindent
Proof of the final assertion. Let
$f : (\mathcal{C}', \mathcal{O}') \to (\mathcal{C}, \mathcal{O})$
be a morphism of ringed sites. By Lemma \ref{lemma-pullback-K-flat}
the complex $f^*\mathcal{K}^\bullet$ is K-flat with flat terms.
The complex $f^*\mathcal{L}^\bullet$ is K-flat as it is a bounded
above complex of flat $\mathcal{O}'$-modules. We have a short exact
sequence of complexes of $\mathcal{O}'$-modules
$$
0 \to f^*\mathcal{L}^\bullet \to f^*\mathcal{K}^\bullet \to
f^*\mathcal{E}^\bullet \to 0
$$
because the short exact sequence
$0 \to \mathcal{I} \to \mathcal{K}^a \to \mathcal{N} \to 0$
of flat modules pulls back to a short exact sequence.
By Lemma \ref{lemma-K-flat-two-out-of-three-ses}.
the complex $f^*\mathcal{E}^\bullet$ is K-flat and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-tor-amplitude-pullback}
Let $(f, f^\sharp) : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$
be a morphism of ringed sites.
Let $E$ be an object of $D(\mathcal{O}_\mathcal{D})$.
If $E$ has tor amplitude in $[a, b]$,
then $Lf^*E$ has tor amplitude in $[a, b]$.
\end{lemma}

\begin{proof}
Assume $E$ has tor amplitude in $[a, b]$. By
Lemma \ref{lemma-tor-amplitude}
we can represent $E$ by a complex of
$\mathcal{E}^\bullet$ of flat $\mathcal{O}$-modules with
$\mathcal{E}^i = 0$ for $i \not \in [a, b]$. Then
$Lf^*E$ is represented by $f^*\mathcal{E}^\bullet$.
By Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-flat}
the module $f^*\mathcal{E}^i$ are flat.
Thus by Lemma \ref{lemma-tor-amplitude}
we conclude that $Lf^*E$ has tor amplitude in $[a, b]$.
\end{proof}

\begin{lemma}
\label{lemma-cone-tor-amplitude}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(K, L, M, f, g, h)$ be a distinguished
triangle in $D(\mathcal{O})$. Let $a, b \in \mathbf{Z}$.
\begin{enumerate}
\item If $K$ has tor-amplitude in $[a + 1, b + 1]$ and
$L$ has tor-amplitude in $[a, b]$ then $M$ has
tor-amplitude in $[a, b]$.
\item If $K$ and $M$ have tor-amplitude in $[a, b]$, then
$L$ has tor-amplitude in $[a, b]$.
\item If $L$ has tor-amplitude in $[a + 1, b + 1]$
and $M$ has tor-amplitude in $[a, b]$, then
$K$ has tor-amplitude in $[a + 1, b + 1]$.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted. Hint: This just follows from the long exact cohomology sequence
associated to a distinguished triangle and the fact that
$- \otimes_\mathcal{O}^{\mathbf{L}} \mathcal{F}$
preserves distinguished triangles.
The easiest one to prove is (2) and the others follow from it by
translation.
\end{proof}

\begin{lemma}
\label{lemma-tensor-tor-amplitude}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K, L$ be objects of
$D(\mathcal{O})$. If $K$ has tor-amplitude in $[a, b]$ and
$L$ has tor-amplitude in $[c, d]$ then $K \otimes_\mathcal{O}^\mathbf{L} L$
has tor amplitude in $[a + c, b + d]$.
\end{lemma}

\begin{proof}
Omitted. Hint: use the spectral sequence for tors.
\end{proof}

\begin{lemma}
\label{lemma-summands-tor-amplitude}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $a, b \in \mathbf{Z}$.
For $K$, $L$ objects of $D(\mathcal{O})$ if $K \oplus L$ has tor
amplitude in $[a, b]$ so do $K$ and $L$.
\end{lemma}

\begin{proof}
Clear from the fact that the Tor functors are additive.
\end{proof}

\begin{lemma}
\label{lemma-bounded}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{I} \subset \mathcal{O}$ be a sheaf of ideals.
Let $K$ be an object of $D(\mathcal{O})$.
\begin{enumerate}
\item If $K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}$
is bounded above, then
$K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}^n$
is uniformly bounded above for all $n$.
\item If $K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}$
as an object of $D(\mathcal{O}/\mathcal{I})$ has tor amplitude in $[a, b]$,
then $K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}^n$
as an object of $D(\mathcal{O}/\mathcal{I}^n)$
has tor amplitude in $[a, b]$ for all $n$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Assume that
$K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}$
is bounded above, say
$H^i(K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}) = 0$
for $i > b$. Note that we have distinguished triangles
$$
K \otimes_\mathcal{O}^\mathbf{L}
\mathcal{I}^n/\mathcal{I}^{n + 1} \to
K \otimes_\mathcal{O}^\mathbf{L}
\mathcal{O}/\mathcal{I}^{n + 1} \to
K \otimes_\mathcal{O}^\mathbf{L}
\mathcal{O}/\mathcal{I}^n \to
K \otimes_\mathcal{O}^\mathbf{L}
\mathcal{I}^n/\mathcal{I}^{n + 1}[1]
$$
and that
$$
K \otimes_\mathcal{O}^\mathbf{L}
\mathcal{I}^n/\mathcal{I}^{n + 1} =
\left(
K \otimes_\mathcal{O}^\mathbf{L}
\mathcal{O}/\mathcal{I}\right)
\otimes_{\mathcal{O}/\mathcal{I}}^\mathbf{L}
\mathcal{I}^n/\mathcal{I}^{n + 1}
$$
By induction we conclude that
$H^i(K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}^n) = 0$
for $i > b$ for all $n$.

\medskip\noindent
Proof of (2). Assume $K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}$
as an object of $D(\mathcal{O}/\mathcal{I})$ has tor amplitude in $[a, b]$.
Let $\mathcal{F}$ be a sheaf of $\mathcal{O}/\mathcal{I}^n$-modules.
Then we have a finite filtration
$$
0 \subset \mathcal{I}^{n - 1}\mathcal{F} \subset \ldots
\subset \mathcal{I}\mathcal{F} \subset \mathcal{F}
$$
whose successive quotients are sheaves of $\mathcal{O}/\mathcal{I}$-modules.
Thus to prove that $K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}^n$
has tor amplitude in $[a, b]$ it suffices to show
$H^i(K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}^n
\otimes_{\mathcal{O}/\mathcal{I}^n}^\mathbf{L} \mathcal{G})$
is zero for $i \not \in [a, b]$ for all $\mathcal{O}/\mathcal{I}$-modules
$\mathcal{G}$. Since
$$
\left(K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}^n\right)
\otimes_{\mathcal{O}/\mathcal{I}^n}^\mathbf{L} \mathcal{G}
=
\left(K \otimes_\mathcal{O}^\mathbf{L} \mathcal{O}/\mathcal{I}\right)
\otimes_{\mathcal{O}/\mathcal{I}}^\mathbf{L} \mathcal{G}
$$
for every sheaf of $\mathcal{O}/\mathcal{I}$-modules $\mathcal{G}$
the result follows.
\end{proof}

\begin{lemma}
\label{lemma-tor-amplitude-stalk}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $E$ be an object of $D(\mathcal{O})$.
Let $a, b \in \mathbf{Z}$.
\begin{enumerate}
\item If $E$ has tor amplitude in $[a, b]$, then for every point $p$
of the site $\mathcal{C}$ the object $E_p$ of $D(\mathcal{O}_p)$
has tor amplitude in $[a, b]$.
\item If $\mathcal{C}$ has enough points, then the converse is true.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). This follows because taking stalks at $p$ is
the same as pulling back by the morphism of ringed sites
$(p, \mathcal{O}_p) \to (\mathcal{C}, \mathcal{O})$ and hence
we can apply Lemma \ref{lemma-tor-amplitude-pullback}.

\medskip\noindent
Proof of (2). If $\mathcal{C}$ has enough points, then we can check
vanishing of
$H^i(E \otimes_\mathcal{O}^\mathbf{L} \mathcal{F})$
at stalks, see
Modules on Sites, Lemma \ref{sites-modules-lemma-check-exactness-stalks}.
Since $H^i(E \otimes_\mathcal{O}^\mathbf{L} \mathcal{F})_p =
H^i(E_p \otimes_{\mathcal{O}_p}^\mathbf{L} \mathcal{F}_p)$ we conclude.
\end{proof}










\section{Perfect complexes}
\label{section-perfect}

\noindent
In this section we discuss properties of perfect complexes on
ringed sites.

\begin{definition}
\label{definition-perfect}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{E}^\bullet$ be a complex of $\mathcal{O}$-modules.
We say $\mathcal{E}^\bullet$ is {\it perfect} if for every object $U$ of
$\mathcal{C}$ there exists a covering $\{U_i \to U\}$ such that for each $i$
there exists a morphism of complexes
$\mathcal{E}_i^\bullet \to \mathcal{E}^\bullet|_{U_i}$
which is a quasi-isomorphism with $\mathcal{E}_i^\bullet$
strictly perfect.
An object $E$ of $D(\mathcal{O})$ is {\it perfect}
if it can be represented by a perfect complex of $\mathcal{O}$-modules.
\end{definition}

\begin{lemma}
\label{lemma-perfect-independent-representative}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $E$ be an object of $D(\mathcal{O})$.
\begin{enumerate}
\item If $\mathcal{C}$ has a final object $X$ and there exist a
covering $\{U_i \to X\}$, strictly perfect complexes $\mathcal{E}_i^\bullet$
of $\mathcal{O}_{U_i}$-modules, and isomorphisms
 $\alpha_i : \mathcal{E}_i^\bullet \to E|_{U_i}$ in
$D(\mathcal{O}_{U_i})$, then $E$ is perfect.
\item If $E$ is perfect, then any complex representing $E$ is perfect.
\end{enumerate}
\end{lemma}

\begin{proof}
Identical to the proof of
Lemma \ref{lemma-pseudo-coherent-independent-representative}.
\end{proof}

\begin{lemma}
\label{lemma-perfect-precise}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $E$ be an object of $D(\mathcal{O})$.
Let $a \leq b$ be integers. If $E$ has tor amplitude in $[a, b]$
and is $(a - 1)$-pseudo-coherent, then $E$ is perfect.
\end{lemma}

\begin{proof}
Let $U$ be an object of $\mathcal{C}$. After replacing $U$ by the members
of a covering and $\mathcal{C}$ by the localization $\mathcal{C}/U$
we may assume there exists a strictly perfect complex $\mathcal{E}^\bullet$
and a map $\alpha : \mathcal{E}^\bullet \to E$ such that $H^i(\alpha)$ is
an isomorphism for $i \geq a$. We may and do replace
$\mathcal{E}^\bullet$ by $\sigma_{\geq a - 1}\mathcal{E}^\bullet$. Choose a
distinguished triangle
$$
\mathcal{E}^\bullet \to E \to C \to \mathcal{E}^\bullet[1]
$$
From the vanishing of cohomology sheaves of $E$ and $\mathcal{E}^\bullet$
and the assumption on $\alpha$ we obtain $C \cong \mathcal{K}[a - 2]$ with
$\mathcal{K} = \Ker(\mathcal{E}^{a - 1} \to \mathcal{E}^a)$.
Let $\mathcal{F}$ be an $\mathcal{O}$-module.
Applying $- \otimes_\mathcal{O}^\mathbf{L} \mathcal{F}$
the assumption that $E$ has tor amplitude in $[a, b]$
implies $\mathcal{K} \otimes_\mathcal{O} \mathcal{F} \to
\mathcal{E}^{a - 1} \otimes_\mathcal{O} \mathcal{F}$ has image
$\Ker(\mathcal{E}^{a - 1} \otimes_\mathcal{O} \mathcal{F}
\to \mathcal{E}^a \otimes_\mathcal{O} \mathcal{F})$.
It follows that $\text{Tor}_1^\mathcal{O}(\mathcal{E}', \mathcal{F}) = 0$
where $\mathcal{E}' = \Coker(\mathcal{E}^{a - 1} \to \mathcal{E}^a)$.
Hence $\mathcal{E}'$ is flat (Lemma \ref{lemma-flat-tor-zero}).
Thus there exists a covering $\{U_i \to U\}$ such that
$\mathcal{E}'|_{U_i}$ is a direct summand of a finite free module by
Modules on Sites, Lemma
\ref{sites-modules-lemma-flat-locally-finite-presentation}.
Thus the complex
$$
\mathcal{E}'|_{U_i} \to \mathcal{E}^{a - 1}|_{U_i} \to \ldots \to
\mathcal{E}^b|_{U_i}
$$
is quasi-isomorphic to $E|_{U_i}$ and $E$ is perfect.
\end{proof}

\begin{lemma}
\label{lemma-perfect}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $E$ be an object of $D(\mathcal{O})$.
The following are equivalent
\begin{enumerate}
\item $E$ is perfect, and
\item $E$ is pseudo-coherent and locally has finite tor dimension.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1). Let $U$ be an object of $\mathcal{C}$.
By definition there exists a covering $\{U_i \to U\}$ such that
$E|_{U_i}$ is represented by a strictly perfect complex.
Thus $E$ is pseudo-coherent (i.e., $m$-pseudo-coherent for all $m$) by
Lemma \ref{lemma-pseudo-coherent-independent-representative}.
Moreover, a direct summand of a finite free module is flat, hence
$E|_{U_i}$ has finite Tor dimension by
Lemma \ref{lemma-tor-amplitude}. Thus (2) holds.

\medskip\noindent
Assume (2). Let $U$ be an object of $\mathcal{C}$.
After replacing $U$ by the members of a covering
we may assume there exist integers $a \leq b$ such that $E|_U$
has tor amplitude in $[a, b]$. Since $E|_U$ is $m$-pseudo-coherent
for all $m$ we conclude using Lemma \ref{lemma-perfect-precise}.
\end{proof}

\begin{lemma}
\label{lemma-perfect-pullback}
Let $(f, f^\sharp) : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{D}, \mathcal{O}_\mathcal{D})$
be a morphism of ringed sites.
Let $E$ be an object of $D(\mathcal{O}_\mathcal{D})$.
If $E$ is perfect in $D(\mathcal{O}_\mathcal{D})$,
then $Lf^*E$ is perfect in $D(\mathcal{O}_\mathcal{C})$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-perfect},
\ref{lemma-tor-amplitude-pullback}, and
\ref{lemma-pseudo-coherent-pullback}.
\end{proof}

\begin{lemma}
\label{lemma-two-out-of-three-perfect}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $(K, L, M, f, g, h)$
be a distinguished triangle in $D(\mathcal{O})$. If two out of three of
$K, L, M$ are perfect then the third is also perfect.
\end{lemma}

\begin{proof}
First proof: Combine
Lemmas \ref{lemma-perfect}, \ref{lemma-cone-pseudo-coherent}, and
\ref{lemma-cone-tor-amplitude}.
Second proof (sketch): Say $K$ and $L$ are perfect. Let $U$ be an object
of $\mathcal{C}$. After replacing
$U$ by the members of a covering we may assume that $K|_U$ and $L|_U$
are represented by strictly perfect complexes $\mathcal{K}^\bullet$
and $\mathcal{L}^\bullet$. After replacing $U$ by the members
of a covering we may assume the map $K|_U \to L|_U$ is given by
a map of complexes $\alpha : \mathcal{K}^\bullet \to \mathcal{L}^\bullet$,
see Lemma \ref{lemma-local-actual}.
Then $M|_U$ is isomorphic to the cone of $\alpha$ which is strictly
perfect by Lemma \ref{lemma-cone}.
\end{proof}

\begin{lemma}
\label{lemma-tensor-perfect}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
If $K, L$ are perfect objects of $D(\mathcal{O})$, then
so is $K \otimes_\mathcal{O}^\mathbf{L} L$.
\end{lemma}

\begin{proof}
Follows from
Lemmas \ref{lemma-perfect}, \ref{lemma-tensor-pseudo-coherent}, and
\ref{lemma-tensor-tor-amplitude}.
\end{proof}

\begin{lemma}
\label{lemma-summands-perfect}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
If $K \oplus L$ is a perfect object of $D(\mathcal{O})$, then
so are $K$ and $L$.
\end{lemma}

\begin{proof}
Follows from
Lemmas \ref{lemma-perfect}, \ref{lemma-summands-pseudo-coherent}, and
\ref{lemma-summands-tor-amplitude}.
\end{proof}














\section{Duals}
\label{section-duals}

\noindent
In this section we characterize the dualizable objects of
the category of complexes and of the derived category.
In particular, we will see that an object of $D(\mathcal{O})$
has a dual if and only if it is perfect (this follows from
Example \ref{example-dual-derived} and
Lemma \ref{lemma-left-dual-derived}).

\begin{lemma}
\label{lemma-symmetric-monoidal-cat-complexes}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed space. The category of complexes
of $\mathcal{O}$-modules with tensor product defined by
$\mathcal{F}^\bullet \otimes \mathcal{G}^\bullet =
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{G}^\bullet)$
is a symmetric monoidal category.
\end{lemma}

\begin{proof}
Omitted. Hints: as unit $\mathbf{1}$ we take the complex having
$\mathcal{O}$ in degree $0$ and zero in other degrees with
obvious isomorphisms
$\text{Tot}(\mathbf{1} \otimes_\mathcal{O} \mathcal{G}^\bullet) =
\mathcal{G}^\bullet$ and
$\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathbf{1}) =
\mathcal{F}^\bullet$.
to prove the lemma you have to check the commutativity
of various diagrams, see Categories, Definitions
\ref{categories-definition-monoidal-category} and
\ref{categories-definition-symmetric-monoidal-category}.
The verifications are straightforward in each case.
\end{proof}

\begin{example}
\label{example-dual}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{F}^\bullet$
be a complex of $\mathcal{O}$-modules such that for every
$U \in \Ob(\mathcal{C})$ there exists a covering $\{U_i \to U\}$
such that $\mathcal{F}^\bullet|_{U_i}$ is strictly perfect.
Consider the complex
$$
\mathcal{G}^\bullet = \SheafHom^\bullet(\mathcal{F}^\bullet, \mathcal{O})
$$
as in Section \ref{section-hom-complexes}. Let
$$
\eta :
\mathcal{O}
\to
\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathcal{G}^\bullet)
\quad\text{and}\quad
\epsilon :
\text{Tot}(\mathcal{G}^\bullet \otimes_\mathcal{O} \mathcal{F}^\bullet)
\to
\mathcal{O}
$$
be $\eta = \sum \eta_n$ and $\epsilon = \sum \epsilon_n$
where $\eta_n : \mathcal{O} \to
\mathcal{F}^n \otimes_\mathcal{O} \mathcal{G}^{-n}$
and
$\epsilon_n : \mathcal{G}^{-n} \otimes_\mathcal{O} \mathcal{F}^n
\to \mathcal{O}$ are as in
Modules on Sites, Example \ref{sites-modules-example-dual}.
Then $\mathcal{G}^\bullet, \eta, \epsilon$
is a left dual for $\mathcal{F}^\bullet$ as in
Categories, Definition \ref{categories-definition-dual}.
We omit the verification that
$(1 \otimes \epsilon) \circ (\eta \otimes 1) = \text{id}_{\mathcal{F}^\bullet}$
and
$(\epsilon \otimes 1) \circ (1 \otimes \eta) =
\text{id}_{\mathcal{G}^\bullet}$. Please compare with
More on Algebra, Lemma \ref{more-algebra-lemma-left-dual-complex}.
\end{example}

\begin{lemma}
\label{lemma-left-dual-complex}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{F}^\bullet$
be a complex of $\mathcal{O}$-modules. If $\mathcal{F}^\bullet$
has a left dual in the monoidal category of complexes of
$\mathcal{O}$-modules
(Categories, Definition \ref{categories-definition-dual})
then for every object $U$ of $\mathcal{C}$ there exists a
covering $\{U_i \to U\}$ such that $\mathcal{F}^\bullet|_{U_i}$
is strictly perfect and the left dual is as constructed in
Example \ref{example-dual}.
\end{lemma}

\begin{proof}
By uniqueness of left duals
(Categories, Remark \ref{categories-remark-left-dual-adjoint})
we get the final statement provided we show that $\mathcal{F}^\bullet$
is as stated. Let $\mathcal{G}^\bullet, \eta, \epsilon$ be a left dual.
Write $\eta = \sum \eta_n$ and $\epsilon = \sum \epsilon_n$
where $\eta_n : \mathcal{O} \to
\mathcal{F}^n \otimes_\mathcal{O} \mathcal{G}^{-n}$
and
$\epsilon_n : \mathcal{G}^{-n} \otimes_\mathcal{O} \mathcal{F}^n
\to \mathcal{O}$. Since
$(1 \otimes \epsilon) \circ (\eta \otimes 1) = \text{id}_{\mathcal{F}^\bullet}$
and
$(\epsilon \otimes 1) \circ (1 \otimes \eta) = \text{id}_{\mathcal{G}^\bullet}$
by Categories, Definition \ref{categories-definition-dual} we see immediately
that we have
$(1 \otimes \epsilon_n) \circ (\eta_n \otimes 1) = \text{id}_{\mathcal{F}^n}$
and
$(\epsilon_n \otimes 1) \circ (1 \otimes \eta_n) =
\text{id}_{\mathcal{G}^{-n}}$.
In other words, we see that $\mathcal{G}^{-n}$ is a left dual of
$\mathcal{F}^n$ and we see that
Modules on Sites, Lemma \ref{sites-modules-lemma-left-dual-module}
applies to each $\mathcal{F}^n$. Let $U$ be an object of $\mathcal{C}$.
There exists a covering $\{U_i \to U\}$ such that for every
$i$ only a finite number of $\eta_n|_{U_i}$ are nonzero.
Thus after replacing $U$ by $U_i$ we may assume only a finite
number of $\eta_n|_U$ are nonzero and by the lemma cited
this implies only a finite number of $\mathcal{F}^n|_U$ are 
nonzero. Using the lemma again we can then find a covering
$\{U_i \to U\}$ such that each
$\mathcal{F}^n|_{U_i}$ is a direct summand of a finite
free $\mathcal{O}$-module and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-dual-perfect-complex}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $K$ be a perfect object of $D(\mathcal{O})$.
Then $K^\vee = R\SheafHom(K, \mathcal{O})$ is a
perfect object too and $(K^\vee)^\vee \cong K$. There are
functorial isomorphisms
$$
M \otimes^\mathbf{L}_\mathcal{O} K^\vee = R\SheafHom_\mathcal{O}(K, M)
$$
and
$$
H^0(\mathcal{C}, M \otimes^\mathbf{L}_\mathcal{O} K^\vee) =
\Hom_{D(\mathcal{O})}(K, M)
$$
for $M$ in $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
We will us without further mention that formation of internal hom commutes
with restriction (Lemma \ref{lemma-restriction-RHom-to-U}). Let $U$
be an arbitrary object of $\mathcal{C}$. To check that
$K^\vee$ is perfect, it suffices to show that there exists a covering
$\{U_i \to U\}$ such that $K^\vee|_{U_i}$ is perfect for all $i$.
There is a canonical map
$$
K = R\SheafHom(\mathcal{O}_X, \mathcal{O}_X)
\otimes_{\mathcal{O}_X}^\mathbf{L} K \longrightarrow
R\SheafHom(R\SheafHom(K, \mathcal{O}_X), \mathcal{O}_X) =
(K^\vee)^\vee
$$
see Lemma \ref{lemma-internal-hom-evaluate}. It suffices to prove there
is a covering $\{U_i \to U\}$ such that the restriction of this map
to $\mathcal{C}/U_i$ is an isomorphism for all $i$.
By Lemma \ref{lemma-dual} to see the final statement it suffices to check
that the map (\ref{equation-eval})
$$
M \otimes^\mathbf{L}_\mathcal{O} K^\vee
\longrightarrow
R\SheafHom(K, M)
$$
is an isomorphism. This is a local question as well (in the sense above).
Hence it suffices to prove the lemma when $K$ is represented
by a strictly perfect complex.

\medskip\noindent
Assume $K$ is represented by the strictly perfect complex
$\mathcal{E}^\bullet$. Then it follows from
Lemma \ref{lemma-Rhom-strictly-perfect}
that $K^\vee$ is represented by the complex whose terms are
$(\mathcal{E}^n)^\vee =
\SheafHom_\mathcal{O}(\mathcal{E}^n, \mathcal{O})$
in degree $-n$. Since $\mathcal{E}^n$ is a direct summand of a finite
free $\mathcal{O}$-module, so is $(\mathcal{E}^n)^\vee$.
Hence $K^\vee$ is represented by a strictly perfect complex too 
and we see that $K^\vee$ is perfect.
The map $K \to (K^\vee)^\vee$ is an isomorphism as it is given up
to sign by the evaluation maps
$\mathcal{E}^n \to ((\mathcal{E}^n)^\vee)^\vee$ which are
isomorphisms. To see that (\ref{equation-eval}) is an isomorphism, represent
$M$ by a K-flat complex $\mathcal{F}^\bullet$.
By Lemma \ref{lemma-Rhom-strictly-perfect} the complex
$R\SheafHom(K, M)$ is represented by the complex with terms
$$
\bigoplus\nolimits_{n = p + q}
\SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{F}^p)
$$
On the other hand, the object $M \otimes^\mathbf{L}_\mathcal{O} K^\vee$
is represented by the complex with terms
$$
\bigoplus\nolimits_{n = p + q}
\mathcal{F}^p \otimes_\mathcal{O} (\mathcal{E}^{-q})^\vee
$$
Thus the assertion that (\ref{equation-eval}) is an isomorphism
reduces to the assertion that the canonical map
$$
\mathcal{F}
\otimes_\mathcal{O}
\SheafHom_\mathcal{O}(\mathcal{E}, \mathcal{O})
\longrightarrow
\SheafHom_\mathcal{O}(\mathcal{E}, \mathcal{F})
$$
is an isomorphism when $\mathcal{E}$ is a direct summand of a finite
free $\mathcal{O}$-module and $\mathcal{F}$ is any $\mathcal{O}$-module.
This follows immediately from the corresponding statement when
$\mathcal{E}$ is finite free.
\end{proof}

\begin{lemma}
\label{lemma-symmetric-monoidal-derived}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. The derived category
$D(\mathcal{O})$ is a symmetric monoidal category with tensor product
given by derived tensor product with usual associativity and
commutativity constraints (for sign rules, see
More on Algebra, Section \ref{more-algebra-section-sign-rules}).
\end{lemma}

\begin{proof}
Omitted. Compare with Lemma \ref{lemma-symmetric-monoidal-cat-complexes}.
\end{proof}

\begin{example}
\label{example-dual-derived}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $K$ be a perfect object
of $D(\mathcal{O})$. Set $K^\vee = R\SheafHom(K, \mathcal{O})$
as in Lemma \ref{lemma-dual-perfect-complex}.
Then the map
$$
K \otimes_\mathcal{O}^\mathbf{L} K^\vee \longrightarrow R\SheafHom(K, K)
$$
is an isomorphism (by the lemma). Denote
$$
\eta :
\mathcal{O}
\longrightarrow
K \otimes_\mathcal{O}^\mathbf{L} K^\vee
$$
the map sending $1$ to the section corresponding to
$\text{id}_K$ under the isomorphism above.
Denote
$$
\epsilon : 
K^\vee
\otimes_\mathcal{O}^\mathbf{L} K
\longrightarrow
\mathcal{O}
$$
the evaluation map (to construct it you can use
Lemma \ref{lemma-internal-hom-composition} for example). Then
$K^\vee, \eta, \epsilon$ is a left dual for $K$ as in
Categories, Definition \ref{categories-definition-dual}.
We omit the verification that
$(1 \otimes \epsilon) \circ (\eta \otimes 1) = \text{id}_K$
and
$(\epsilon \otimes 1) \circ (1 \otimes \eta) =
\text{id}_{K^\vee}$.
\end{example}

\begin{lemma}
\label{lemma-left-dual-derived}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $M$ be an object
of $D(\mathcal{O})$. If $M$ has a left dual in the monoidal category
$D(\mathcal{O})$ (Categories, Definition \ref{categories-definition-dual})
then $M$ is perfect and the left dual is as constructed in
Example \ref{example-dual-derived}.
\end{lemma}

\begin{proof}
Let $N, \eta, \epsilon$ be a left dual. Observe that for any object
$U$ of $\mathcal{C}$ the restriction $N|_U, \eta|_U, \epsilon|_U$
is a left dual for $M|_U$.

\medskip\noindent
Let $U$ be an object of $\mathcal{C}$. It suffices to find a covering
$\{U_i \to U\}_{i \in I}$ fo $\mathcal{C}$ such that $M|_{U_i}$ is
a perfect object of $D(\mathcal{O}_{U_i})$. Hence we may replace
$\mathcal{C}, \mathcal{O}, M, N, \eta, \epsilon$ by
$\mathcal{C}/U, \mathcal{O}_U, M|_U, N|_U, \eta|_U, \epsilon|_U$
and assume $\mathcal{C}$ has a final object $X$. Moreover, during the
proof we can (finitely often) replace $X$ by the members of a
covering $\{U_i \to X\}$ of $X$.

\medskip\noindent
We are going to use the following argument several times. Choose any
complex $\mathcal{M}^\bullet$
of $\mathcal{O}$-modules representing $M$. Choose a K-flat complex
$\mathcal{N}^\bullet$ representing $N$ whose terms are flat
$\mathcal{O}$-modules, see Lemma \ref{lemma-K-flat-resolution}.
Consider the map
$$
\eta : \mathcal{O} \to
\text{Tot}(\mathcal{M}^\bullet \otimes_\mathcal{O} \mathcal{N}^\bullet)
$$
After replacing $X$ by the members of a covering,
we can find an integer $N$ and for
$i = 1, \ldots, N$ integers $n_i \in \mathbf{Z}$ and sections
$f_i$ and $g_i$ of $\mathcal{M}^{n_i}$ and $\mathcal{N}^{-n_i}$
such that
$$
\eta(1) = \sum\nolimits_i f_i \otimes g_i
$$
Let $\mathcal{K}^\bullet \subset \mathcal{M}^\bullet$ be any subcomplex
of $\mathcal{O}$-modules containing the sections $f_i$
for $i = 1, \ldots, N$.
Since
$\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{N}^\bullet)
\subset
\text{Tot}(\mathcal{M}^\bullet \otimes_\mathcal{O} \mathcal{N}^\bullet)$
by flatness of the modules $\mathcal{N}^n$, we see that $\eta$ factors through
$$
\tilde \eta :
\mathcal{O} \to
\text{Tot}(\mathcal{K}^\bullet \otimes_\mathcal{O} \mathcal{N}^\bullet)
$$
Denoting $K$ the object of $D(\mathcal{O})$ represented by
$\mathcal{K}^\bullet$ we find a commutative diagram
$$
\xymatrix{
M \ar[rr]_-{\eta \otimes 1} \ar[rrd]_{\tilde \eta \otimes 1} & &
M \otimes^\mathbf{L} N \otimes^\mathbf{L} M
\ar[r]_-{1 \otimes \epsilon} &
M \\
& &
K \otimes^\mathbf{L} N \otimes^\mathbf{L} M
\ar[u] \ar[r]^-{1 \otimes \epsilon} &
K \ar[u]
}
$$
Since the composition of the upper row is the identity on $M$
we conclude that $M$ is a direct summand of $K$ in $D(\mathcal{O})$.

\medskip\noindent
As a first use of the argument above, we can choose the subcomplex
$\mathcal{K}^\bullet = \sigma_{\geq a} \tau_{\leq b}\mathcal{M}^\bullet$
with $a < n_i < b$ for $i = 1, \ldots, N$. Thus $M$ is a direct
summand in $D(\mathcal{O})$ of a bounded complex and we conclude
we may assume $M$ is in $D^b(\mathcal{O})$. (Recall that the process
above involves replacing $X$ by the members of a covering.)

\medskip\noindent
Since $M$ is in $D^b(\mathcal{O})$ we may choose
$\mathcal{M}^\bullet$ to be a bounded above complex of
flat modules (by Modules, Lemma \ref{modules-lemma-module-quotient-flat} and
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}).
Then we can choose $\mathcal{K}^\bullet = \sigma_{\geq a}\mathcal{M}^\bullet$
with $a < n_i$ for $i = 1, \ldots, N$ in the argument above.
Thus we find that we may assume $M$ is a direct summand in
$D(\mathcal{O})$ of a bounded complex of flat modules.
In particular, we find $M$ has finite tor amplitude.

\medskip\noindent
Say $M$ has tor amplitude in $[a, b]$. Assuming $M$ is $m$-pseudo-coherent
we are going to show that (after replacing $X$ by the members of a covering)
we may assume $M$ is $(m - 1)$-pseudo-coherent. This will finish the proof by
Lemma \ref{lemma-perfect-precise} and the fact that
$M$ is $(b + 1)$-pseudo-coherent in any case. After replacing $X$
by the members of a covering we may assume there exists a strictly perfect
complex $\mathcal{E}^\bullet$ and a map $\alpha : \mathcal{E}^\bullet \to M$
in $D(\mathcal{O})$ such that $H^i(\alpha)$ is an isomorphism for
$i > m$ and surjective for $i = m$. We may and do assume
that $\mathcal{E}^i = 0$ for $i < m$. Choose a distinguished triangle
$$
\mathcal{E}^\bullet \to M \to L \to \mathcal{E}^\bullet[1]
$$
Observe that $H^i(L) = 0$ for $i \geq m$. Thus we may represent
$L$ by a complex $\mathcal{L}^\bullet$ with $\mathcal{L}^i = 0$
for $i \geq m$. The map $L \to \mathcal{E}^\bullet[1]$
is given by a map of complexes
$\mathcal{L}^\bullet \to \mathcal{E}^\bullet[1]$
which is zero in all degrees except in degree $m - 1$
where we obtain a map $\mathcal{L}^{m - 1} \to \mathcal{E}^m$, see
Derived Categories, Lemma \ref{derived-lemma-negative-exts}.
Then $M$ is represented by the complex
$$
\mathcal{M}^\bullet :
\ldots \to
\mathcal{L}^{m - 2} \to
\mathcal{L}^{m - 1} \to
\mathcal{E}^m \to
\mathcal{E}^{m + 1} \to \ldots
$$
Apply the discussion in the second paragraph to this complex to get
sections $f_i$ of $\mathcal{M}^{n_i}$ for $i = 1, \ldots, N$.
For $n < m$ let $\mathcal{K}^n \subset \mathcal{L}^n$
be the $\mathcal{O}$-submodule generated by the sections
$f_i$ for $n_i = n$ and $d(f_i)$ for $n_i = n - 1$.
For $n \geq m$ set $\mathcal{K}^n = \mathcal{E}^n$.
Clearly, we have a morphism of
distinguished triangles
$$
\xymatrix{
\mathcal{E}^\bullet \ar[r] &
\mathcal{M}^\bullet \ar[r] &
\mathcal{L}^\bullet \ar[r] &
\mathcal{E}^\bullet[1] \\
\mathcal{E}^\bullet \ar[r] \ar[u] &
\mathcal{K}^\bullet \ar[r] \ar[u] &
\sigma_{\leq m - 1}\mathcal{K}^\bullet \ar[r] \ar[u] &
\mathcal{E}^\bullet[1] \ar[u]
}
$$
where all the morphisms are as indicated above.
Denote $K$ the object of $D(\mathcal{O})$ corresponding to the complex
$\mathcal{K}^\bullet$.
By the arguments in the second paragraph of the proof we obtain
a morphism $s : M \to K$ in $D(\mathcal{O})$ such that the composition
$M \to K \to M$ is the identity on $M$. We don't know that the
diagram
$$
\xymatrix{
\mathcal{E}^\bullet \ar[r] &
\mathcal{K}^\bullet \ar@{=}[r] &
K \\
\mathcal{E}^\bullet \ar[u]^{\text{id}} \ar[r]^i &
\mathcal{M}^\bullet \ar@{=}[r] &
M \ar[u]_s
}
$$
commutes, but we do know it commutes after composing with the
map $K \to M$. By Lemma \ref{lemma-local-actual} after replacing
$X$ by the members of a covering, we may
assume that $s \circ i$ is given by a map of complexes
$\sigma : \mathcal{E}^\bullet \to \mathcal{K}^\bullet$.
By the same lemma we may assume the composition of $\sigma$
with the inclusion $\mathcal{K}^\bullet \subset \mathcal{M}^\bullet$
is homotopic to zero by some homotopy
$\{h^i : \mathcal{E}^i \to \mathcal{M}^{i - 1}\}$.
Thus, after replacing $\mathcal{K}^{m - 1}$ by
$\mathcal{K}^{m - 1} + \Im(h^m)$ (note that after doing this
it is still the case that $\mathcal{K}^{m - 1}$ is generated
by finitely many global sections), we see that
$\sigma$ itself is homotopic to zero!
This means that we have a commutative solid diagram
$$
\xymatrix{
\mathcal{E}^\bullet \ar[r] &
M \ar[r] &
\mathcal{L}^\bullet \ar[r] &
\mathcal{E}^\bullet[1] \\
\mathcal{E}^\bullet \ar[r] \ar[u] &
K \ar[r] \ar[u] &
\sigma_{\leq m - 1}\mathcal{K}^\bullet \ar[r] \ar[u] &
\mathcal{E}^\bullet[1] \ar[u] \\
\mathcal{E}^\bullet \ar[r] \ar[u] &
M \ar[r] \ar[u]^s &
\mathcal{L}^\bullet \ar[r] \ar@{..>}[u] &
\mathcal{E}^\bullet[1] \ar[u]
}
$$
By the axioms of triangulated categories we obtain a dotted
arrow fitting into the diagram.
Looking at cohomology sheaves in degree $m - 1$ we see that we obtain
$$
\xymatrix{
H^{m - 1}(M) \ar[r] &
H^{m - 1}(\mathcal{L}^\bullet) \ar[r] &
H^m(\mathcal{E}^\bullet) \\
H^{m - 1}(K) \ar[r] \ar[u] &
H^{m - 1}(\sigma_{\leq m - 1}\mathcal{K}^\bullet) \ar[r] \ar[u] &
H^m(\mathcal{E}^\bullet) \ar[u] \\
H^{m - 1}(M) \ar[r] \ar[u] &
H^{m - 1}(\mathcal{L}^\bullet) \ar[r] \ar[u] &
H^m(\mathcal{E}^\bullet) \ar[u]
}
$$
Since the vertical compositions are the identity in both the
left and right column, we conclude the vertical composition
$H^{m - 1}(\mathcal{L}^\bullet) \to
H^{m - 1}(\sigma_{\leq m - 1}\mathcal{K}^\bullet) \to
H^{m - 1}(\mathcal{L}^\bullet)$ in the middle is surjective!
In particular $H^{m - 1}(\sigma_{\leq m - 1}\mathcal{K}^\bullet) \to
H^{m - 1}(\mathcal{L}^\bullet)$ is surjective.
Using the induced map of long exact sequences of cohomology
sheaves from the morphism of triangles above, a diagram chase
shows this implies $H^i(K) \to H^i(M)$ is an isomorphism
for $i \geq m$ and surjective for $i = m - 1$.
By construction we can choose an $r \geq 0$ and a surjection
$\mathcal{O}^{\oplus r} \to \mathcal{K}^{m - 1}$. Then the
composition
$$
(\mathcal{O}^{\oplus r} \to \mathcal{E}^m \to
\mathcal{E}^{m + 1} \to \ldots ) \longrightarrow
K \longrightarrow M
$$
induces an isomorphism on cohomology sheaves in degrees $\geq m$ and
a surjection in degree $m - 1$ and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-colim-and-lim-of-duals}
\begin{slogan}
Trivial duality for systems of perfect objects.
\end{slogan}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(K_n)_{n \in \mathbf{N}}$ be a system of perfect objects of $D(\mathcal{O})$.
Let $K = \text{hocolim} K_n$ be the derived colimit
(Derived Categories, Definition \ref{derived-definition-derived-colimit}).
Then for any object $E$ of $D(\mathcal{O})$ we have
$$
R\SheafHom(K, E) = R\lim E \otimes^\mathbf{L}_\mathcal{O} K_n^\vee
$$
where $(K_n^\vee)$ is the inverse system of dual perfect complexes.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-dual-perfect-complex} we have
$R\lim E \otimes^\mathbf{L}_\mathcal{O} K_n^\vee =
R\lim R\SheafHom(K_n, E)$
which fits into the distinguished triangle
$$
R\lim R\SheafHom(K_n, E) \to
\prod R\SheafHom(K_n, E) \to
\prod R\SheafHom(K_n, E)
$$
Because $K$ similarly fits into the distinguished triangle
$\bigoplus K_n \to \bigoplus K_n \to K$ it suffices to show that
$\prod R\SheafHom(K_n, E) = R\SheafHom(\bigoplus K_n, E)$.
This is a formal consequence of (\ref{equation-internal-hom})
and the fact that derived tensor product commutes with direct sums.
\end{proof}






\section{Invertible objects in the derived category}
\label{section-invertible-D-or-R}

\noindent
We characterize invertible objects in the derived category of
a ringed space (both in the case of a locally ringed topos and
in the general case).

\begin{lemma}
\label{lemma-category-summands-finite-free}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed space.
Set $R = \Gamma(\mathcal{C}, \mathcal{O})$. The category of
$\mathcal{O}$-modules which are summands of finite free
$\mathcal{O}$-modules is equivalent to the category of
finite projective $R$-modules.
\end{lemma}

\begin{proof}
Observe that a finite projective $R$-module is the same thing
as a summand of a finite free $R$-module.
The equivalence is given by the functor $\mathcal{E} \mapsto
\Gamma(\mathcal{C}, \mathcal{E})$.
The inverse functor is given by the following construction.
Consider the morphism of topoi $f : \Sh(\mathcal{C}) \to \Sh(\text{pt})$
with $f_*$ given by taking global sections and
$f^{-1}$ by sending a set $S$, i.e., an object of
$\Sh(\text{pt})$, to the constant sheaf with value $S$.
We obtain a morphism
$(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}) \to (\Sh(\text{pt}), R)$
of ringed topoi by using the identity map $R \to f_*\mathcal{O}$.
Then the inverse functor is given by $f^*$.
\end{proof}

\begin{lemma}
\label{lemma-invertible-derived}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $M$ be an object
of $D(\mathcal{O})$. The following are equivalent
\begin{enumerate}
\item $M$ is invertible in $D(\mathcal{O})$, see
Categories, Definition \ref{categories-definition-invertible}, and
\item there is a locally finite\footnote{This means that for every
object $U$ of $\mathcal{C}$ there is a covering $\{U_i \to U\}$
such that for every $i$ the sheaf $\mathcal{O}_n|_{U_i}$ is nonzero
for only a finite number of $n$.} direct product decomposition
$$
\mathcal{O} = \prod\nolimits_{n \in \mathbf{Z}} \mathcal{O}_n
$$
and for each $n$ there is an invertible $\mathcal{O}_n$-module
$\mathcal{H}^n$
(Modules on Sites, Definition \ref{sites-modules-definition-invertible-sheaf})
and $M = \bigoplus \mathcal{H}^n[-n]$ in $D(\mathcal{O})$.
\end{enumerate}
If (1) and (2) hold, then $M$ is a perfect object of $D(\mathcal{O})$. If
$(\mathcal{C}, \mathcal{O})$ is a locally ringed site these condition
are also equivalent to
\begin{enumerate}
\item[(3)] for every object $U$ of $\mathcal{C}$ there exists a
covering $\{U_i \to U\}$ and for each $i$ an integer $n_i$ such that
$M|_{U_i}$ is represented by an invertible $\mathcal{O}_{U_i}$-module
placed in degree $n_i$.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (2). Consider the object $R\SheafHom(M, \mathcal{O})$
and the composition map
$$
R\SheafHom(M, \mathcal{O}) \otimes_\mathcal{O}^\mathbf{L} M \to \mathcal{O}
$$
To prove this is an isomorphism, we may work locally. Thus we may
assume $\mathcal{O} = \prod_{a \leq n \leq b} \mathcal{O}_n$
and $M = \bigoplus_{a \leq n \leq b} \mathcal{H}^n[-n]$.
Then it suffices to show that
$$
R\SheafHom(\mathcal{H}^m, \mathcal{O})
\otimes_\mathcal{O}^\mathbf{L} \mathcal{H}^n
$$
is zero if $n \not = m$ and equal to $\mathcal{O}_n$ if $n = m$.
The case $n \not = m$ follows from the fact that $\mathcal{O}_n$ and
$\mathcal{O}_m$ are flat $\mathcal{O}$-algebras with
$\mathcal{O}_n \otimes_\mathcal{O} \mathcal{O}_m = 0$.
Using the local structure of invertible $\mathcal{O}$-modules
(Modules on Sites, Lemma \ref{sites-modules-lemma-invertible})
and working locally
the isomorphism in case $n = m$ follows in a straightforward manner;
we omit the details. Because $D(\mathcal{O})$ is symmetric monoidal,
we conclude that $M$ is invertible.

\medskip\noindent
Assume (1). The description in (2) shows that we have a candidate
for $\mathcal{O}_n$, namely,
$\SheafHom_\mathcal{O}(H^n(M), H^n(M))$.
If this is a locally finite family of sheaves of rings
and if $\mathcal{O} = \prod \mathcal{O}_n$, then we immediately
obtain the direct sum decomposition $M = \bigoplus H^n(M)[-n]$
using the idempotents in $\mathcal{O}$ coming from the product
decomposition. This shows that in order to prove (2) we may work
locally in the following sense. Let $U$ be an object of $\mathcal{C}$.
We have to show there exists a covering
$\{U_i \to U\}$ of $U$ such that with $\mathcal{O}_n$ as above
we have the statements above and those of (2) after
restriction to $\mathcal{C}/U_i$.
Thus we may assume $\mathcal{C}$ has a final object $X$
and during the proof of (2) we may finitely many times
replace $X$ by the members of a covering of $X$.

\medskip\noindent
Choose an object $N$ of $D(\mathcal{O})$ and an isomorphism
$M \otimes_\mathcal{O}^\mathbf{L} N \cong \mathcal{O}$.
Then $N$ is a left dual for $M$ in the monoidal category
$D(\mathcal{O})$ and we conclude that $M$ is perfect by
Lemma \ref{lemma-left-dual-derived}. By symmetry we see that
$N$ is perfect. After replacing $X$ by the members of a covering,
we may assume $M$ and $N$ are represented by a strictly perfect
complexes $\mathcal{E}^\bullet$ and $\mathcal{F}^\bullet$.
Then $M \otimes_\mathcal{O}^\mathbf{L} N$ is represented by
$\text{Tot}(\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F}^\bullet)$.
After replacing $X$ by the members of a covering of $X$
we may assume the mutually inverse isomorphisms
$\mathcal{O} \to M \otimes_\mathcal{O}^\mathbf{L} N$ and
$M \otimes_\mathcal{O}^\mathbf{L} N \to \mathcal{O}$
are given by maps of complexes
$$
\alpha : \mathcal{O} \to
\text{Tot}(\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F}^\bullet)
\quad\text{and}\quad
\beta :
\text{Tot}(\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F}^\bullet)
\to \mathcal{O}
$$
See Lemma \ref{lemma-local-actual}. Then $\beta \circ \alpha = 1$
as maps of complexes and $\alpha \circ \beta = 1$ as a morphism
in $D(\mathcal{O})$. After replacing $X$ by the members of a covering
of $X$ we may assume the composition $\alpha \circ \beta$ is homotopic to $1$
by some homotopy $\theta$ with components
$$
\theta^n :
\text{Tot}^n(\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F}^\bullet)
\to
\text{Tot}^{n - 1}(
\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F}^\bullet)
$$
by the same lemma as before. Set $R = \Gamma(\mathcal{C}, \mathcal{O})$. By
Lemma \ref{lemma-category-summands-finite-free}
we find that we obtain
\begin{enumerate}
\item $M^\bullet = \Gamma(X, \mathcal{E}^\bullet)$
is a bounded complex of finite projective $R$-modules,
\item $N^\bullet = \Gamma(X, \mathcal{F}^\bullet)$
is a bounded complex of finite projective $R$-modules,
\item $\alpha$ and $\beta$ correspond to maps of complexes
$a : R \to \text{Tot}(M^\bullet \otimes_R N^\bullet)$ and
$b : \text{Tot}(M^\bullet \otimes_R N^\bullet) \to R$,
\item $\theta^n$ corresponds to a map
$h^n : \text{Tot}^n(M^\bullet \otimes_R N^\bullet) \to
\text{Tot}^{n - 1}(M^\bullet \otimes_R N^\bullet)$, and
\item $b \circ a = 1$ and $b \circ a - 1 = dh + hd$,
\end{enumerate}
It follows that $M^\bullet$ and $N^\bullet$ define
mutually inverse objects of $D(R)$. By
More on Algebra, Lemma \ref{more-algebra-lemma-invertible-derived}
we find a product decomposition $R = \prod_{a \leq n \leq b} R_n$
and invertible $R_n$-modules $H^n$ such
that $M^\bullet \cong \bigoplus_{a \leq n \leq b} H^n[-n]$.
This isomorphism in $D(R)$ can be lifted to an morphism
$$
\bigoplus H^n[-n] \longrightarrow M^\bullet
$$
of complexes because each $H^n$ is projective as an $R$-module.
Correspondingly, using Lemma \ref{lemma-category-summands-finite-free} again,
we obtain an morphism
$$
\bigoplus H^n \otimes_R \mathcal{O}[-n] \to \mathcal{E}^\bullet
$$
which is an isomorphism in $D(\mathcal{O})$. Here $M \otimes_R \mathcal{O}$
denotes the functor from finite projective $R$-modules to $\mathcal{O}$-modules
constructed in the proof of Lemma \ref{lemma-category-summands-finite-free}.
Setting $\mathcal{O}_n = R_n \otimes_R \mathcal{O}$ we conclude
(2) is true.

\medskip\noindent
If $(\mathcal{C}, \mathcal{O})$ is a locally ringed site,
then given an object $U$ and a finite product decomposition
$\mathcal{O}|_U = \prod_{a \leq n \leq b} \mathcal{O}_n|_U$
we can find a covering $\{U_i \to U\}$ such that for every
$i$ there is at most one $n$ with $\mathcal{O}_n|_{U_i}$ nonzero.
This follows readily from part (2) of
Modules on Sites, Lemma \ref{sites-modules-lemma-locally-ringed}
and the definition of locally ringed sites as given in
Modules on Sites, Definition \ref{sites-modules-definition-locally-ringed}.
From this the implication (2) $\Rightarrow$ (3) is easily seen.
The implication (3) $\Rightarrow$ (2) holds without any assumptions
on the ringed site. We omit the details.
\end{proof}










\section{Projection formula}
\label{section-projection-formula}

\noindent
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $E \in D(\mathcal{O}_\mathcal{C})$ and $K \in D(\mathcal{O}_\mathcal{D})$.
Without any further assumptions there is a map
\begin{equation}
\label{equation-projection-formula-map}
Rf_*E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{D}} K
\longrightarrow
Rf_*(E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{C}} Lf^*K)
\end{equation}
Namely, it is the adjoint to the canonical map
$$
Lf^*(Rf_*E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{D}} K) =
Lf^*Rf_*E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{C}} Lf^*K
\longrightarrow
E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{C}} Lf^*K
$$
coming from the map $Lf^*Rf_*E \to E$ and Lemmas
\ref{lemma-pullback-tensor-product} and \ref{lemma-adjoint}.
A reasonably general version of the projection formula is the following.

\begin{lemma}
\label{lemma-projection-formula}
Let $f : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \to
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$ be a morphism of ringed topoi.
Let $E \in D(\mathcal{O}_\mathcal{C})$ and $K \in D(\mathcal{O}_\mathcal{D})$.
If $K$ is perfect, then
$$
Rf_*E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{D}} K =
Rf_*(E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{C}} Lf^*K)
$$
in $D(\mathcal{O}_\mathcal{D})$.
\end{lemma}

\begin{proof}
To check (\ref{equation-projection-formula-map}) is an isomorphism
we may work locally on $\mathcal{D}$, i.e.,
for any object $V$ of $\mathcal{D}$ we have to find a covering $\{V_j \to V\}$
such that the map restricts to an isomorphism on $V_j$. By definition
of perfect objects, this means we may assume $K$ is represented by
a strictly perfect complex of $\mathcal{O}_\mathcal{D}$-modules.
Note that, completely generally, the statement is true for
$K = K_1 \oplus K_2$, if and only if the statement is true for
$K_1$ and $K_2$. Hence we may assume $K$ is a finite
complex of finite free $\mathcal{O}_\mathcal{D}$-modules.
In this case a simple argument involving stupid truncations reduces
the statement to the case where $K$ is represented by a finite
free $\mathcal{O}_\mathcal{D}$-module. Since the statement is invariant
under finite direct summands in the $K$ variable, we conclude
it suffices to prove it for $K = \mathcal{O}_\mathcal{D}[n]$
in which case it is trivial.
\end{proof}

\begin{remark}
\label{remark-compatible-with-diagram}
The map (\ref{equation-projection-formula-map}) is compatible with the
base change map of Remark \ref{remark-base-change} in the following sense.
Namely, suppose that
$$
\xymatrix{
(\Sh(\mathcal{C}'), \mathcal{O}_{\mathcal{C}'})
\ar[r]_{g'} \ar[d]_{f'} &
(\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C}) \ar[d]^f \\
(\Sh(\mathcal{D}'), \mathcal{O}_{\mathcal{D}'})
\ar[r]^g &
(\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})
}
$$
is a commutative diagram of ringed topoi.
Let $E \in D(\mathcal{O}_\mathcal{C})$ and $K \in D(\mathcal{O}_\mathcal{D})$.
Then the diagram
$$
\xymatrix{
Lg^*(Rf_*E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{D}} K)
\ar[r]_p \ar[d]_t &
Lg^*Rf_*(E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{C}} Lf^*K)
\ar[d]_b \\
Lg^*Rf_*E \otimes^\mathbf{L}_{\mathcal{O}_{\mathcal{D}'}}
Lg^*K \ar[d]_b &
Rf'_*L(g')^*(E \otimes^\mathbf{L}_{\mathcal{O}_\mathcal{C}}
Lf^*K) \ar[d]_t \\
Rf'_*L(g')^*E \otimes^\mathbf{L}_{\mathcal{O}_{\mathcal{D}'}}
Lg^*K \ar[rd]_p &
Rf'_*(L(g')^*E \otimes^\mathbf{L}_{\mathcal{O}_{\mathcal{D}'}}
L(g')^*Lf^*K) \ar[d]_c \\
& Rf'_*(L(g')^*E \otimes^\mathbf{L}_{\mathcal{O}_{\mathcal{D}'}}
L(f')^*Lg^*K)
}
$$
is commutative. Here arrows labeled $t$ are gotten by an application of
Lemma \ref{lemma-pullback-tensor-product}, arrows labeled $b$ by an
application of Remark \ref{remark-base-change}, arrows labeled $p$
by an application of (\ref{equation-projection-formula-map}), and
$c$ comes from $L(g')^* \circ Lf^* = L(f')^* \circ Lg^*$.
We omit the verification.
\end{remark}






\section{Weakly contractible objects}
\label{section-w-contractible}

\noindent
An object $U$ of a site is {\it weakly contractible} if every surjection
$\mathcal{F} \to \mathcal{G}$ of sheaves of sets gives rise to a surjection
$\mathcal{F}(U) \to \mathcal{G}(U)$, see
Sites, Definition \ref{sites-definition-w-contractible}.

\begin{lemma}
\label{lemma-w-contractible}
Let $\mathcal{C}$ be a site. Let $U$ be a weakly contractible
object of $\mathcal{C}$. Then
\begin{enumerate}
\item the functor $\mathcal{F} \mapsto \mathcal{F}(U)$ is an exact
functor $\textit{Ab}(\mathcal{C}) \to \textit{Ab}$,
\item $H^p(U, \mathcal{F}) = 0$
for every abelian sheaf $\mathcal{F}$ and all $p \geq 1$, and
\item for any sheaf of groups $\mathcal{G}$ any $\mathcal{G}$-torsor
has a section over $U$.
\end{enumerate}
\end{lemma}

\begin{proof}
The first statement follows immediately from the definition
(see also Homology, Section \ref{homology-section-functors}).
The higher derived functors vanish by
Derived Categories, Lemma \ref{derived-lemma-right-derived-exact-functor}.
Let $\mathcal{F}$ be a $\mathcal{G}$-torsor. Then $\mathcal{F} \to *$
is a surjective map of sheaves. Hence (3) follows from the
definition as well.
\end{proof}

\noindent
It is convenient to list some consequences of having enough
weakly contractible objects here.

\begin{proposition}
\label{proposition-enough-weakly-contractibles}
Let $\mathcal{C}$ be a site. Let $\mathcal{B} \subset \Ob(\mathcal{C})$
such that every $U \in \mathcal{B}$ is weakly contractible and
every object of $\mathcal{C}$ has a covering by elements of $\mathcal{B}$.
Let $\mathcal{O}$ be a sheaf of rings on $\mathcal{C}$. Then
\begin{enumerate}
\item A complex $\mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3$
of $\mathcal{O}$-modules is exact, if and only if
$\mathcal{F}_1(U) \to \mathcal{F}_2(U) \to \mathcal{F}_3(U)$
is exact for all $U \in \mathcal{B}$.
\item Every object $K$ of $D(\mathcal{O})$ is a derived limit
of its canonical truncations: $K = R\lim \tau_{\geq -n} K$.
\item Given an inverse system
$\ldots \to \mathcal{F}_3 \to \mathcal{F}_2 \to \mathcal{F}_1$
with surjective transition maps, the projection
$\lim \mathcal{F}_n \to \mathcal{F}_1$ is surjective.
\item Products are exact on $\textit{Mod}(\mathcal{O})$.
\item Products on $D(\mathcal{O})$ can be computed by taking
products of any representative complexes.
\item If $(\mathcal{F}_n)$ is an inverse system of $\mathcal{O}$-modules,
then $R^p\lim \mathcal{F}_n = 0$ for all $p > 1$ and
$$
R^1\lim \mathcal{F}_n  =
\Coker(\prod \mathcal{F}_n \to \prod \mathcal{F}_n)
$$
where the map is $(x_n) \mapsto (x_n - f(x_{n + 1}))$.
\item If $(K_n)$ is an inverse system of objects of $D(\mathcal{O})$,
then there are short exact sequences
$$
0 \to R^1\lim H^{p - 1}(K_n) \to H^p(R\lim K_n) \to
\lim H^p(K_n) \to 0
$$
\end{enumerate}
\end{proposition}

\begin{proof}
Proof of (1). If the sequence is exact, then evaluating at any
weakly contractible element of $\mathcal{C}$ gives an exact
sequence by Lemma \ref{lemma-w-contractible}. Conversely, assume that
$\mathcal{F}_1(U) \to \mathcal{F}_2(U) \to \mathcal{F}_3(U)$
is exact for all $U \in \mathcal{B}$.
Let $V$ be an object of $\mathcal{C}$ and let
$s \in \mathcal{F}_2(V)$ be an element of the kernel of
$\mathcal{F}_2 \to \mathcal{F}_3$. By assumption there exists
a covering $\{U_i \to V\}$ with $U_i \in \mathcal{B}$.
Then $s|_{U_i}$ lifts to a section $s_i \in \mathcal{F}_1(U_i)$.
Thus $s$ is a section of the image sheaf
$\Im(\mathcal{F}_1 \to \mathcal{F}_2)$.
In other words, the sequence
$\mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3$
is exact.

\medskip\noindent
Proof of (2). This holds by Lemma \ref{lemma-is-limit-dimension} with $d = 0$.

\medskip\noindent
Proof of (3). Let $(\mathcal{F}_n)$ be a system as in (2) and set
$\mathcal{F} = \lim \mathcal{F}_n$. If $U \in \mathcal{B}$, then
$\mathcal{F}(U) = \lim \mathcal{F}_n(U)$
surjects onto $\mathcal{F}_1(U)$ as all the transition maps
$\mathcal{F}_{n + 1}(U) \to \mathcal{F}_n(U)$ are surjective.
Thus $\mathcal{F} \to \mathcal{F}_1$ is surjective by
Sites, Definition \ref{sites-definition-sheaves-injective-surjective}
and the assumption that every object
has a covering by elements of $\mathcal{B}$.

\medskip\noindent
Proof of (4). Let
$\mathcal{F}_{i, 1} \to \mathcal{F}_{i, 2} \to \mathcal{F}_{i, 3}$
be a family of exact sequences of $\mathcal{O}$-modules.
We want to show that
$\prod \mathcal{F}_{i, 1} \to \prod \mathcal{F}_{i, 2} \to
\prod \mathcal{F}_{i, 3}$ is exact. We use the criterion of (1).
Let $U \in \mathcal{B}$. Then
$$
(\prod \mathcal{F}_{i, 1})(U) \to
(\prod \mathcal{F}_{i, 2})(U) \to
(\prod \mathcal{F}_{i, 3})(U)
$$
is the same as
$$
\prod \mathcal{F}_{i, 1}(U) \to
\prod \mathcal{F}_{i, 2}(U) \to
\prod \mathcal{F}_{i, 3}(U)
$$
Each of the sequences
$\mathcal{F}_{i, 1}(U) \to \mathcal{F}_{i, 2}(U) \to \mathcal{F}_{i, 3}(U)$
are exact by (1). Thus the displayed sequences are exact by
Homology, Lemma \ref{homology-lemma-product-abelian-groups-exact}.
We conclude by (1) again.

\medskip\noindent
Proof of (5). Follows from (4) and (slightly generalized)
Derived Categories, Lemma \ref{derived-lemma-products}.

\medskip\noindent
Proof of (6) and (7). We refer to Section \ref{section-derived-limits}
for a discussion of derived and homotopy limits and their relationship.
By Derived Categories, Definition \ref{derived-definition-derived-limit}
we have a distinguished
triangle
$$
R\lim K_n \to \prod K_n \to \prod K_n \to R\lim K_n[1]
$$
Taking the long exact sequence of cohomology sheaves we obtain
$$
H^{p - 1}(\prod K_n) \to H^{p - 1}(\prod K_n) \to
H^p(R\lim K_n) \to H^p(\prod K_n) \to H^p(\prod K_n)
$$
Since products are exact by (4) this becomes
$$
\prod H^{p - 1}(K_n) \to \prod H^{p - 1}(K_n) \to
H^p(R\lim K_n) \to \prod H^p(K_n) \to \prod H^p(K_n)
$$
Now we first apply this to the case $K_n = \mathcal{F}_n[0]$
where $(\mathcal{F}_n)$ is as in (6). We conclude that (6) holds.
Next we apply it to $(K_n)$ as in (7) and we conclude (7) holds.
\end{proof}






\section{Compact objects}
\label{section-compact}

\noindent
In this section we study compact objects in the derived category of modules
on a ringed site. We recall that compact objects are defined in
Derived Categories, Definition \ref{derived-definition-compact-object}.

\begin{lemma}
\label{lemma-compact-in-terms-of-generators}
Let $\mathcal{A}$ be a Grothendieck abelian category. Let
$S \subset \Ob(\mathcal{A})$ be a set of objects such that
\begin{enumerate}
\item any object of $\mathcal{A}$ is a quotient of a direct sum
of elements of $S$, and
\item for any $E \in S$ the functor $\Hom_\mathcal{A}(E, -)$
commutes with direct sums.
\end{enumerate}
Then every compact object of $D(\mathcal{A})$ is a direct summand
in $D(\mathcal{A})$ of a finite complex of finite direct sums of
elements of $S$.
\end{lemma}

\begin{proof}
Assume $K \in D(\mathcal{A})$ is a compact object. Represent $K$ by a complex
$K^\bullet$ and consider the map
$$
K^\bullet
\longrightarrow
\bigoplus\nolimits_{n \geq 0} \tau_{\geq n} K^\bullet
$$
where we have used the canonical truncations, see
Homology, Section \ref{homology-section-truncations}.
This makes sense as in each degree the direct sum on the right is finite.
By assumption this map factors through a finite direct sum.
We conclude that $K \to \tau_{\geq n} K$ is zero for at least one $n$,
i.e., $K$ is in $D^{-}(R)$.

\medskip\noindent
We may represent $K$ by a bounded above complex $K^\bullet$ each of whose
terms is a direct sum of objects from $S$, see
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}.
Note that we have
$$
K^\bullet = \bigcup\nolimits_{n \leq 0} \sigma_{\geq n}K^\bullet
$$
where we have used the stupid truncations, see
Homology, Section \ref{homology-section-truncations}.
Hence by Derived Categories, Lemmas \ref{derived-lemma-colim-hocolim} and
\ref{derived-lemma-commutes-with-countable-sums}
we see that $1 : K^\bullet \to K^\bullet$ factors through
$\sigma_{\geq n}K^\bullet \to K^\bullet$ in $D(R)$.
Thus we see that $1 : K^\bullet \to K^\bullet$ factors as
$$
K^\bullet \xrightarrow{\varphi} L^\bullet \xrightarrow{\psi} K^\bullet
$$
in $D(\mathcal{A})$ for some complex $L^\bullet$ which is bounded and
whose terms are direct sums of elements of $S$. Say $L^i$ is zero for
$i \not \in [a, b]$. Let $c$ be the largest integer $\leq b + 1$ such
that $L^i$ a finite direct sum of elements of $S$ for $i < c$.
Claim: if $c < b + 1$, then we can modify $L^\bullet$ to increase $c$.
By induction this claim will show we have a factorization
of $1_K$ as
$$
K \xrightarrow{\varphi} L \xrightarrow{\psi} K
$$
in $D(\mathcal{A})$ where $L$ can be represented by a finite
complex of finite direct sums of elements of $S$. Note that
$e = \varphi \circ \psi \in \text{End}_{D(\mathcal{A})}(L)$
is an idempotent. By Derived Categories,
Lemma \ref{derived-lemma-projectors-have-images-triangulated}
we see that $L = \Ker(e) \oplus \Ker(1 - e)$.
The map $\varphi : K \to L$ induces an isomorphism with
$\Ker(1 - e)$ in $D(R)$ and we conclude.

\medskip\noindent
Proof of the claim. Write $L^c = \bigoplus_{\lambda \in \Lambda} E_\lambda$.
Since $L^{c - 1}$ is a finite direct sum of elements of $S$
we can by assumption (2) find a finite subset
$\Lambda' \subset \Lambda$ such that $L^{c - 1} \to L^c$ factors
through $\bigoplus_{\lambda \in \Lambda'} E_\lambda \subset L^c$.
Consider the map of complexes
$$
\pi :
L^\bullet
\longrightarrow
(\bigoplus\nolimits_{\lambda \in \Lambda \setminus \Lambda'} E_\lambda)[-i]
$$
given by the projection onto the factors corresponding to
$\Lambda \setminus \Lambda'$ in degree $i$.
By our assumption on $K$ we see that, after possibly replacing $\Lambda'$ by
a larger finite subset, we may assume that $\pi \circ \varphi = 0$
in $D(\mathcal{A})$.
Let $(L')^\bullet \subset L^\bullet$ be the kernel of $\pi$.
Since $\pi$ is surjective we get a short exact sequence of complexes,
which gives a distinguished triangle in $D(\mathcal{A})$ (see
Derived Categories, Lemma \ref{derived-lemma-derived-canonical-delta-functor}).
Since $\Hom_{D(\mathcal{A})}(K, -)$ is homological (see
Derived Categories, Lemma \ref{derived-lemma-representable-homological})
and $\pi \circ \varphi = 0$, we can find a morphism
$\varphi' : K^\bullet \to (L')^\bullet$ in $D(\mathcal{A})$ whose
composition with $(L')^\bullet \to L^\bullet$ gives $\varphi$.
Setting $\psi'$ equal to the composition of $\psi$ with
$(L')^\bullet \to L^\bullet$ we obtain a new factorization.
Since $(L')^\bullet$ agrees with $L^\bullet$ except in degree $c$
and since $(L')^c = \bigoplus_{\lambda \in \Lambda'} E_\lambda$ the
claim is proved.
\end{proof}

\begin{lemma}
\label{lemma-compact-objects-if-enough-qc}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Assume every object of
$\mathcal{C}$ has a covering by quasi-compact objects. Then every
compact object of $D(\mathcal{O})$ is a direct summand in $D(\mathcal{O})$
of a finite complex whose terms are finite direct sums of
$\mathcal{O}$-modules of the form $j_!\mathcal{O}_U$
where $U$ is a quasi-compact object of $\mathcal{C}$.
\end{lemma}

\begin{proof}
Apply Lemma \ref{lemma-compact-in-terms-of-generators}
where $S \subset \Ob(\textit{Mod}(\mathcal{O}))$ is the set of modules
of the form $j_!\mathcal{O}_U$ with $U \in \Ob(\mathcal{C})$
quasi-compact. Assumption (1) holds by
Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat}
and the assumption that every $U$ can be covered by quasi-compact
objects. Assumption (2) follows as
$$
\Hom_\mathcal{O}(j_!\mathcal{O}_U, \mathcal{F}) = \mathcal{F}(U)
$$
which commutes with direct sums by
Sites, Lemma \ref{sites-lemma-directed-colimits-sections}.
\end{proof}

\noindent
In the situation of the lemma above it is not always true that the
modules $j_!\mathcal{O}_U$ are compact objects of $D(\mathcal{O})$
(even if $U$ is a quasi-compact object of $\mathcal{C}$).
Here are two lemmas addressing this issue.


\begin{lemma}
\label{lemma-when-jshriek-lower-compact}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an object of
$\mathcal{C}$. Assume the functors $\mathcal{F} \mapsto H^p(U, \mathcal{F})$
commute with direct sums. Then $\mathcal{O}$-module $j_!\mathcal{O}_U$ is a
compact object of $D^+(\mathcal{O})$ in the following sense:
if $M = \bigoplus_{i \in I} M_i$ in $D(\mathcal{O})$ is
bounded below, then $\Hom(j_{U!}\mathcal{O}_U, M) =
\bigoplus_{i \in I} \Hom(j_{U!}\mathcal{O}_U, M_i)$.
\end{lemma}

\begin{proof}
Since $\Hom(j_{U!}\mathcal{O}_U, -)$ is the same as the functor
$\mathcal{F} \mapsto \mathcal{F}(U)$ by
Modules on Sites, Equation
(\ref{sites-modules-equation-map-lower-shriek-OU-into-module}) it suffices
to prove that $H^p(U, M) = \bigoplus H^p(U, M_i)$.
Let $\mathcal{I}_i$, $i \in I$ be a collection of injective
$\mathcal{O}$-modules. By assumption we have
$$
H^p(U, \bigoplus\nolimits_{i \in I} \mathcal{I}_i) =
\bigoplus\nolimits_{i \in I} H^p(U, \mathcal{I}_i) = 0
$$
for all $p$. Since $M = \bigoplus M_i$ is bounded below, we
see that there exists an $a \in \mathbf{Z}$ such that $H^n(M_i) = 0$
for $n < a$. Thus we can choose complexes of injective $\mathcal{O}$-modues
$\mathcal{I}_i^\bullet$ representing $M_i$
with $\mathcal{I}_i^n = 0$ for $n < a$, see
Derived Categories, Lemma \ref{derived-lemma-injective-resolutions-exist}.
By Injectives, Lemma \ref{injectives-lemma-derived-products}
we see that the direct sum complex $\bigoplus \mathcal{I}_i^\bullet$
represents $M$. By Leray acyclicity
(Derived Categories, Lemma \ref{derived-lemma-leray-acyclicity})
we see that
$$
R\Gamma(U, M) = \Gamma(U, \bigoplus \mathcal{I}_i^\bullet) =
\bigoplus \Gamma(U, \bigoplus \mathcal{I}_i^\bullet) =
\bigoplus R\Gamma(U, M_i)
$$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-when-jshriek-lower-compact-worked-out}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site
with set of coverings $\text{Cov}_\mathcal{C}$.
Let $\mathcal{B} \subset \Ob(\mathcal{C})$, and
$\text{Cov} \subset \text{Cov}_\mathcal{C}$
be subsets. Assume that
\begin{enumerate}
\item For every $\mathcal{U} \in \text{Cov}$ we have
$\mathcal{U} = \{U_i \to U\}_{i \in I}$ with $I$ finite,
$U, U_i \in \mathcal{B}$ and every
$U_{i_0} \times_U \ldots \times_U U_{i_p} \in \mathcal{B}$.
\item For every $U \in \mathcal{B}$ the coverings of $U$
occurring in $\text{Cov}$ is a cofinal system of coverings of $U$.
\end{enumerate}
Then for $U \in \mathcal{B}$ the object $j_{U!}\mathcal{O}_U$ is
a compact object of $D^+(\mathcal{O})$ in the following sense:
if $M = \bigoplus_{i \in I} M_i$ in $D(\mathcal{O})$ is
bounded below, then $\Hom(j_{U!}\mathcal{O}_U, M) =
\bigoplus_{i \in I} \Hom(j_{U!}\mathcal{O}_U, M_i)$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-when-jshriek-lower-compact}
and Lemma \ref{lemma-colim-works-over-collection}.
\end{proof}

\begin{lemma}
\label{lemma-when-jshriek-compact}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$ be an object of
$\mathcal{C}$. The $\mathcal{O}$-module $j_!\mathcal{O}_U$ is a
compact object of $D(\mathcal{O})$ if there exists an integer $d$ such that
\begin{enumerate}
\item $H^p(U, \mathcal{F}) = 0$ for all $p > d$, and
\item the functors $\mathcal{F} \mapsto H^p(U, \mathcal{F})$
commute with direct sums.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1) and (2). Recall that $\Hom(j_!\mathcal{O}_U, K) = R\Gamma(U, K)$ for
$K$ in $D(\mathcal{O})$. Thus we have to show that $R\Gamma(U, -)$
commutes with direct sums. The first assumption means that the functor
$F = H^0(U, -)$ has finite cohomological dimension. Moreover, the second
assumption implies any direct sum of injective modules is acyclic for $F$.
Let $K_i$ be a family of objects of $D(\mathcal{O})$.
Choose K-injective representatives $I_i^\bullet$ with injective terms
representing $K_i$, see Injectives, Theorem
\ref{injectives-theorem-K-injective-embedding-grothendieck}.
Since we may compute $RF$ by applying $F$ to any complex of acyclics
(Derived Categories, Lemma \ref{derived-lemma-unbounded-right-derived})
and since $\bigoplus K_i$ is represented by $\bigoplus I_i^\bullet$
(Injectives, Lemma \ref{injectives-lemma-derived-products})
we conclude that $R\Gamma(U, \bigoplus K_i)$ is represented by
$\bigoplus H^0(U, I_i^\bullet)$. Hence $R\Gamma(U, -)$ commutes
with direct sums as desired.
\end{proof}

\begin{lemma}
\label{lemma-quasi-compact-weakly-contractible-compact}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $U$
be an object of $\mathcal{C}$ which is quasi-compact and
weakly contractible. Then
$j_!\mathcal{O}_U$ is a compact object of $D(\mathcal{O})$.
\end{lemma}

\begin{proof}
Combine Lemmas \ref{lemma-when-jshriek-compact} and
\ref{lemma-w-contractible} with
Modules on Sites, Lemma \ref{sites-modules-lemma-sections-over-quasi-compact}.
\end{proof}

\begin{lemma}
\label{lemma-perfect-is-compact}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Assume
$\mathcal{C}$ has the following properties
\begin{enumerate}
\item $\mathcal{C}$ has a quasi-compact final object $X$,
\item every quasi-compact object of $\mathcal{C}$
has a cofinal system of coverings which are finite
and consist of quasi-compact objects,
\item for a finite covering $\{U_i \to U\}_{i \in I}$
with $U$, $U_i$ quasi-compact the fibre products $U_i \times_U U_j$ are
quasi-compact.
\end{enumerate}
Let $K$ be a perfect object of $D(\mathcal{O})$. Then
\begin{enumerate}
\item[(a)] $K$ is a compact object of $D^+(\mathcal{O})$
in the following sense: if $M = \bigoplus_{i \in I} M_i$ is
bounded below, then $\Hom(K, M) = \bigoplus_{i \in I} \Hom(K, M_i)$.
\item[(b)] If $(\mathcal{C}, \mathcal{O})$
has finite cohomological dimension, i.e., if there exists
a $d$ such that $H^i(X, \mathcal{F}) = 0$ for $i > d$ for
any $\mathcal{O}$-module $\mathcal{F}$, then
$K$ is a compact object of $D(\mathcal{O})$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $K^\vee$ be the dual of $K$, see
Lemma \ref{lemma-dual-perfect-complex}. Then we have
$$
\Hom_{D(\mathcal{O})}(K, M) =
H^0(X, K^\vee \otimes_\mathcal{O}^\mathbf{L} M)
$$
functorially in $M$ in $D(\mathcal{O})$.
Since $K^\vee \otimes_\mathcal{O}^\mathbf{L} -$ commutes with
direct sums it suffices
to show that $R\Gamma(X, -)$ commutes with the relevant direct sums.

\medskip\noindent
Proof of (a). After reformulation as above this is a special
case of Lemma \ref{lemma-when-jshriek-lower-compact-worked-out} with $U = X$.

\medskip\noindent
Proof of (b). Since $R\Gamma(X, K) = R\Hom(\mathcal{O}, K)$
and since $H^p(X, -)$ commutes with direct sums by
Lemma \ref{lemma-colim-works-over-collection}
this is a special case of
Lemma \ref{lemma-when-jshriek-compact}.
\end{proof}






\section{Complexes with locally constant cohomology sheaves}
\label{section-locally-constant}

\noindent
Locally constant sheaves are introduced in
Modules on Sites, Section \ref{sites-modules-section-locally-constant}.
Let $\mathcal{C}$ be a site.
Let $\Lambda$ be a ring.
We denote $D(\mathcal{C}, \Lambda)$ the derived category of the
abelian category of $\underline{\Lambda}$-modules on $\mathcal{C}$.

\begin{lemma}
\label{lemma-locally-constant}
Let $\mathcal{C}$ be a site with final object $X$.
Let $\Lambda$ be a Noetherian ring.
Let $K \in D^b(\mathcal{C}, \Lambda)$
with $H^i(K)$ locally constant sheaves of $\Lambda$-modules
of finite type. Then there exists a covering $\{U_i \to X\}$
such that each $K|_{U_i}$ is represented by
a complex of locally constant sheaves of $\Lambda$-modules
of finite type.
\end{lemma}

\begin{proof}
Let $a \leq b$ be such that $H^i(K) = 0$ for $i \not \in [a, b]$.
By induction on $b - a$ we will prove there exists a covering
$\{U_i \to X\}$ such that $K|_{U_i}$ can be represented by a complex
$\underline{M^\bullet}_{U_i}$ with $M^p$ a finite type $\Lambda$-module
and $M^p = 0$ for $p \not \in [a, b]$. If $b = a$, then
this is clear. In general, we may replace $X$ by the members
of a covering and assume that $H^b(K)$ is constant, say
$H^b(K) = \underline{M}$. By Modules on Sites, Lemma
\ref{sites-modules-lemma-locally-constant-finite-type}
the module $M$ is a finite $\Lambda$-module. Choose a surjection
$\Lambda^{\oplus r} \to M$ given by generators $x_1, \ldots, x_r$
of $M$.

\medskip\noindent
By a slight generalization of
Lemma \ref{lemma-kill-cohomology-class-on-covering} (details omitted)
there exists a covering $\{U_i \to X\}$ such that $x_i \in H^0(X, H^b(K))$
lifts to an element of $H^b(U_i, K)$. Thus, after replacing $X$ by the
$U_i$ we reach the situation where there is a map
$\underline{\Lambda^{\oplus r}}[-b] \to K$
inducing a surjection on cohomology sheaves in degree $b$.
Choose a distinguished triangle
$$
\underline{\Lambda^{\oplus r}}[-b] \to K \to L \to
\underline{\Lambda^{\oplus r}}[-b + 1]
$$
Now the cohomology sheaves of $L$ are nonzero only in the interval
$[a, b - 1]$, agree with the cohomology sheaves of $K$ in the interval
$[a, b - 2]$ and there is a short exact sequence
$$
0 \to H^{b - 1}(K) \to H^{b - 1}(L) \to
\underline{\Ker(\Lambda^{\oplus r} \to M)} \to 0
$$
in degree $b - 1$. By
Modules on Sites, Lemma
\ref{sites-modules-lemma-kernel-finite-locally-constant}
we see that $H^{b - 1}(L)$ is locally constant of finite type.
By induction hypothesis we obtain an isomorphism
$\underline{M^\bullet} \to L$ in $D(\mathcal{C}, \underline{\Lambda})$
with $M^p$ a finite $\Lambda$-module and $M^p = 0$ for
$p \not \in [a, b - 1]$. The map $L \to \Lambda^{\oplus r}[-b + 1]$
gives a map $\underline{M^{b - 1}} \to \underline{\Lambda^{\oplus r}}$
which locally is constant
(Modules on Sites, Lemma
\ref{sites-modules-lemma-morphism-locally-constant}).
Thus we may assume it is given by a map $M^{b - 1} \to \Lambda^{\oplus r}$.
The distinguished triangle shows that the composition
$M^{b - 2} \to M^{b - 1} \to \Lambda^{\oplus r}$ is zero
and the axioms of triangulated categories produce an isomorphism
$$
\underline{M^a \to \ldots \to M^{b - 1} \to \Lambda^{\oplus r}}
\longrightarrow K
$$
in $D(\mathcal{C}, \Lambda)$.
\end{proof}

\noindent
Let $\mathcal{C}$ be a site. Let $\Lambda$ be a ring. Using the
morphism $\Sh(\mathcal{C}) \to \Sh(pt)$ we see that there is a
functor $D(\Lambda) \to D(\mathcal{C}, \Lambda)$, $K \mapsto \underline{K}$.

\begin{lemma}
\label{lemma-map-out-of-locally-constant}
Let $\mathcal{C}$ be a site with final object $X$. Let $\Lambda$ be a ring. Let
\begin{enumerate}
\item $K$ a perfect object of $D(\Lambda)$,
\item a finite complex $K^\bullet$ of finite projective $\Lambda$-modules
representing $K$,
\item $\mathcal{L}^\bullet$ a complex of sheaves of $\Lambda$-modules, and
\item $\varphi : \underline{K} \to \mathcal{L}^\bullet$ a map in
$D(\mathcal{C}, \Lambda)$.
\end{enumerate}
Then there exists a covering $\{U_i \to X\}$ and maps of complexes
$\alpha_i : \underline{K}^\bullet|_{U_i} \to \mathcal{L}^\bullet|_{U_i}$
representing $\varphi|_{U_i}$.
\end{lemma}

\begin{proof}
Follows immediately from Lemma \ref{lemma-local-actual}.
\end{proof}

\begin{lemma}
\label{lemma-locally-constant-map}
Let $\mathcal{C}$ be a site with final object $X$.
Let $\Lambda$ be a ring. Let $K, L$ be objects of
$D(\Lambda)$ with $K$ perfect. Let $\varphi : \underline{K} \to \underline{L}$
be map in $D(\mathcal{C}, \Lambda)$. There exists a covering $\{U_i \to X\}$
such that $\varphi|_{U_i}$ is equal to $\underline{\alpha_i}$
for some map $\alpha_i : K \to L$ in $D(\Lambda)$.
\end{lemma}

\begin{proof}
Follows from Lemma \ref{lemma-map-out-of-locally-constant} and
Modules on Sites, Lemma \ref{sites-modules-lemma-morphism-locally-constant}.
\end{proof}

\begin{lemma}
\label{lemma-locally-constant-tensor-product}
Let $\mathcal{C}$ be a site. Let $\Lambda$ be a Noetherian ring.
Let $K, L \in D^-(\mathcal{C}, \Lambda)$. If the cohomology sheaves of
$K$ and $L$ are locally constant sheaves of $\Lambda$-modules of
finite type, then the cohomology sheaves of
$K \otimes_\Lambda^\mathbf{L} L$
are locally constant sheaves of $\Lambda$-modules of finite type.
\end{lemma}

\begin{proof}
We'll prove this as an application of Lemma \ref{lemma-locally-constant}.
Note that $H^i(K \otimes_\Lambda^\mathbf{L} L)$ is the same as
$H^i(\tau_{\geq i - 1}K \otimes_\Lambda^\mathbf{L} \tau_{\geq i - 1}L)$.
Thus we may assume $K$ and $L$ are bounded. By
Lemma \ref{lemma-locally-constant}
we may assume that $K$ and $L$ are represented by
complexes of locally constant sheaves of $\Lambda$-modules
of finite type. Then we can replace these complexes by
bounded above complexes of finite free $\Lambda$-modules.
In this case the result is clear.
\end{proof}

\begin{lemma}
\label{lemma-locally-constant-bounded}
Let $\mathcal{C}$ be a site. Let $\Lambda$ be a Noetherian ring.
Let $I \subset \Lambda$ be an ideal.
Let $K \in D^-(\mathcal{C}, \Lambda)$. If the cohomology sheaves of
$K \otimes_\Lambda^\mathbf{L} \underline{\Lambda/I}$ are locally constant
sheaves of $\Lambda/I$-modules of finite type, then the cohomology sheaves of
$K \otimes_\Lambda^\mathbf{L} \underline{\Lambda/I^n}$
are locally constant sheaves of $\Lambda/I^n$-modules of finite type for all
$n \geq 1$.
\end{lemma}

\begin{proof}
Recall that the locally constant sheaves of $\Lambda$-modules of finite type
form a weak Serre subcategory of all $\underline{\Lambda}$-modules, see
Modules on Sites, Lemma
\ref{sites-modules-lemma-kernel-finite-locally-constant}.
Thus the subcategory of $D(\mathcal{C}, \Lambda)$ consisting of
complexes whose cohomology sheaves are locally constant sheaves
of $\Lambda$-modules of finite type forms a strictly full, saturated
triangulated subcategory of $D(\mathcal{C}, \Lambda)$, see
Derived Categories, Lemma \ref{derived-lemma-cohomology-in-serre-subcategory}.
Next, consider the distinguished triangles
$$
K \otimes_\Lambda^\mathbf{L} \underline{I^n/I^{n + 1}} \to
K \otimes_\Lambda^\mathbf{L} \underline{\Lambda/I^{n + 1}} \to
K \otimes_\Lambda^\mathbf{L} \underline{\Lambda/I^n} \to
K \otimes_\Lambda^\mathbf{L} \underline{I^n/I^{n + 1}}[1]
$$
and the isomorphisms
$$
K \otimes_\Lambda^\mathbf{L} \underline{I^n/I^{n + 1}}
=
\left(K \otimes_\Lambda^\mathbf{L} \underline{\Lambda/I}\right)
\otimes_{\Lambda/I}^\mathbf{L} \underline{I^n/I^{n + 1}}
$$
Combined with Lemma \ref{lemma-locally-constant-tensor-product}
we obtain the result.
\end{proof}






\input{chapters}

\bibliography{my}
\bibliographystyle{amsalpha}

\end{document}
